libs/vkd3d-utils: Return a bool from vkd3d_signal_event().

This commit is contained in:
Henri Verbeet 2016-10-17 18:11:12 +02:00
parent 9d5e4daf84
commit 8d668205a4
4 changed files with 13 additions and 11 deletions

View File

@ -25,12 +25,13 @@
#include "vkd3d_windows.h"
#include "d3d12.h"
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef BOOL (*vkd3d_signal_event_pfn)(HANDLE event);
typedef bool (*vkd3d_signal_event_pfn)(HANDLE event);
struct vkd3d_device_create_info
{

View File

@ -23,7 +23,7 @@
#ifndef __VKD3D_UTILS_H
#define __VKD3D_UTILS_H
#include "vkd3d.h"
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
@ -35,7 +35,7 @@ extern "C" {
#define INFINITE (~0u)
HANDLE vkd3d_create_event(void);
BOOL vkd3d_signal_event(HANDLE event);
bool vkd3d_signal_event(HANDLE event);
unsigned int vkd3d_wait_event(HANDLE event, unsigned int milliseconds);
void vkd3d_destroy_event(HANDLE event);

View File

@ -71,7 +71,7 @@ HANDLE vkd3d_create_event(void)
return NULL;
}
event->is_signaled = FALSE;
event->is_signaled = false;
TRACE("Created event %p.\n", event);
@ -93,8 +93,8 @@ unsigned int vkd3d_wait_event(HANDLE event, unsigned int milliseconds)
if (impl->is_signaled || !milliseconds)
{
BOOL is_signaled = impl->is_signaled;
impl->is_signaled = FALSE;
bool is_signaled = impl->is_signaled;
impl->is_signaled = false;
pthread_mutex_unlock(&impl->mutex);
return is_signaled ? WAIT_OBJECT_0 : WAIT_TIMEOUT;
}
@ -111,7 +111,7 @@ unsigned int vkd3d_wait_event(HANDLE event, unsigned int milliseconds)
}
} while (!impl->is_signaled);
impl->is_signaled = FALSE;
impl->is_signaled = false;
pthread_mutex_unlock(&impl->mutex);
return WAIT_OBJECT_0;
}
@ -121,7 +121,7 @@ unsigned int vkd3d_wait_event(HANDLE event, unsigned int milliseconds)
return WAIT_FAILED;
}
BOOL vkd3d_signal_event(HANDLE event)
bool vkd3d_signal_event(HANDLE event)
{
struct vkd3d_event *impl = event;
int rc;
@ -131,13 +131,13 @@ BOOL vkd3d_signal_event(HANDLE event)
if ((rc = pthread_mutex_lock(&impl->mutex)))
{
ERR("Failed to lock mutex, error %d.\n", rc);
return FALSE;
return false;
}
impl->is_signaled = TRUE;
impl->is_signaled = true;
pthread_cond_signal(&impl->cond);
pthread_mutex_unlock(&impl->mutex);
return TRUE;
return true;
}
void vkd3d_destroy_event(HANDLE event)

View File

@ -24,6 +24,7 @@
#define __VKD3D_UTILS_PRIVATE_H
#include <pthread.h>
#include <vkd3d.h>
#define COBJMACROS
#define NONAMELESSUNION