mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
libs/vkd3d-utils: Return a bool from vkd3d_signal_event().
This commit is contained in:
parent
9d5e4daf84
commit
8d668205a4
@ -25,12 +25,13 @@
|
|||||||
|
|
||||||
#include "vkd3d_windows.h"
|
#include "vkd3d_windows.h"
|
||||||
#include "d3d12.h"
|
#include "d3d12.h"
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
typedef BOOL (*vkd3d_signal_event_pfn)(HANDLE event);
|
typedef bool (*vkd3d_signal_event_pfn)(HANDLE event);
|
||||||
|
|
||||||
struct vkd3d_device_create_info
|
struct vkd3d_device_create_info
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#ifndef __VKD3D_UTILS_H
|
#ifndef __VKD3D_UTILS_H
|
||||||
#define __VKD3D_UTILS_H
|
#define __VKD3D_UTILS_H
|
||||||
|
|
||||||
#include "vkd3d.h"
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -35,7 +35,7 @@ extern "C" {
|
|||||||
#define INFINITE (~0u)
|
#define INFINITE (~0u)
|
||||||
|
|
||||||
HANDLE vkd3d_create_event(void);
|
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);
|
unsigned int vkd3d_wait_event(HANDLE event, unsigned int milliseconds);
|
||||||
void vkd3d_destroy_event(HANDLE event);
|
void vkd3d_destroy_event(HANDLE event);
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ HANDLE vkd3d_create_event(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
event->is_signaled = FALSE;
|
event->is_signaled = false;
|
||||||
|
|
||||||
TRACE("Created event %p.\n", event);
|
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)
|
if (impl->is_signaled || !milliseconds)
|
||||||
{
|
{
|
||||||
BOOL is_signaled = impl->is_signaled;
|
bool is_signaled = impl->is_signaled;
|
||||||
impl->is_signaled = FALSE;
|
impl->is_signaled = false;
|
||||||
pthread_mutex_unlock(&impl->mutex);
|
pthread_mutex_unlock(&impl->mutex);
|
||||||
return is_signaled ? WAIT_OBJECT_0 : WAIT_TIMEOUT;
|
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);
|
} while (!impl->is_signaled);
|
||||||
|
|
||||||
impl->is_signaled = FALSE;
|
impl->is_signaled = false;
|
||||||
pthread_mutex_unlock(&impl->mutex);
|
pthread_mutex_unlock(&impl->mutex);
|
||||||
return WAIT_OBJECT_0;
|
return WAIT_OBJECT_0;
|
||||||
}
|
}
|
||||||
@ -121,7 +121,7 @@ unsigned int vkd3d_wait_event(HANDLE event, unsigned int milliseconds)
|
|||||||
return WAIT_FAILED;
|
return WAIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL vkd3d_signal_event(HANDLE event)
|
bool vkd3d_signal_event(HANDLE event)
|
||||||
{
|
{
|
||||||
struct vkd3d_event *impl = event;
|
struct vkd3d_event *impl = event;
|
||||||
int rc;
|
int rc;
|
||||||
@ -131,13 +131,13 @@ BOOL vkd3d_signal_event(HANDLE event)
|
|||||||
if ((rc = pthread_mutex_lock(&impl->mutex)))
|
if ((rc = pthread_mutex_lock(&impl->mutex)))
|
||||||
{
|
{
|
||||||
ERR("Failed to lock mutex, error %d.\n", rc);
|
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_cond_signal(&impl->cond);
|
||||||
pthread_mutex_unlock(&impl->mutex);
|
pthread_mutex_unlock(&impl->mutex);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vkd3d_destroy_event(HANDLE event)
|
void vkd3d_destroy_event(HANDLE event)
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#define __VKD3D_UTILS_PRIVATE_H
|
#define __VKD3D_UTILS_PRIVATE_H
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <vkd3d.h>
|
||||||
|
|
||||||
#define COBJMACROS
|
#define COBJMACROS
|
||||||
#define NONAMELESSUNION
|
#define NONAMELESSUNION
|
||||||
|
Loading…
Reference in New Issue
Block a user