vkd3d: Move the vkd3d_mutex implementation to vkd3d-common.

This commit is contained in:
Henri Verbeet
2024-03-18 16:09:43 +01:00
committed by Alexandre Julliard
parent 2431357fd6
commit 166dc24b2f
Notes: Alexandre Julliard 2024-03-19 23:18:24 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/732
2 changed files with 60 additions and 67 deletions

View File

@@ -203,36 +203,11 @@ union vkd3d_thread_handle
void *handle;
};
struct vkd3d_mutex
{
CRITICAL_SECTION lock;
};
struct vkd3d_cond
{
CONDITION_VARIABLE cond;
};
static inline void vkd3d_mutex_init(struct vkd3d_mutex *lock)
{
InitializeCriticalSection(&lock->lock);
}
static inline void vkd3d_mutex_lock(struct vkd3d_mutex *lock)
{
EnterCriticalSection(&lock->lock);
}
static inline void vkd3d_mutex_unlock(struct vkd3d_mutex *lock)
{
LeaveCriticalSection(&lock->lock);
}
static inline void vkd3d_mutex_destroy(struct vkd3d_mutex *lock)
{
DeleteCriticalSection(&lock->lock);
}
static inline void vkd3d_cond_init(struct vkd3d_cond *cond)
{
InitializeConditionVariable(&cond->cond);
@@ -288,53 +263,11 @@ union vkd3d_thread_handle
void *handle;
};
struct vkd3d_mutex
{
pthread_mutex_t lock;
};
struct vkd3d_cond
{
pthread_cond_t cond;
};
static inline void vkd3d_mutex_init(struct vkd3d_mutex *lock)
{
int ret;
ret = pthread_mutex_init(&lock->lock, NULL);
if (ret)
ERR("Could not initialize the mutex, error %d.\n", ret);
}
static inline void vkd3d_mutex_lock(struct vkd3d_mutex *lock)
{
int ret;
ret = pthread_mutex_lock(&lock->lock);
if (ret)
ERR("Could not lock the mutex, error %d.\n", ret);
}
static inline void vkd3d_mutex_unlock(struct vkd3d_mutex *lock)
{
int ret;
ret = pthread_mutex_unlock(&lock->lock);
if (ret)
ERR("Could not unlock the mutex, error %d.\n", ret);
}
static inline void vkd3d_mutex_destroy(struct vkd3d_mutex *lock)
{
int ret;
ret = pthread_mutex_destroy(&lock->lock);
if (ret)
ERR("Could not destroy the mutex, error %d.\n", ret);
}
static inline void vkd3d_cond_init(struct vkd3d_cond *cond)
{
int ret;