summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2021-05-04 23:57:24 +0000
committerPeter Zhu <[email protected]>2021-05-04 20:38:03 -0400
commit46dd295a53640a5ccf21688a5539ac50e17008f6 ()
treeceb358b0eda8940f53c2a196d1c2ccb053b3b239
parent3d2e7e2ab5b08625efaa4d1b2b3b127d87e8dad5 (diff)
Fix compilation error in thread_win32.c
USE_WIN32_MUTEX flag may not be defined.
Notes: Merged: https://.com/ruby/ruby/pull/4457
-rw-r--r--thread_win32.c10
1 files changed, 5 insertions, 5 deletions
@@ -322,7 +322,7 @@ native_sleep(rb_thread_t *th, rb_hrtime_t *rel)
void
rb_native_mutex_lock(rb_nativethread_lock_t *lock)
{
-#if USE_WIN32_MUTEX
w32_mutex_lock(lock->mutex, false);
#else
EnterCriticalSection(&lock->crit);
@@ -332,7 +332,7 @@ rb_native_mutex_lock(rb_nativethread_lock_t *lock)
int
rb_native_mutex_trylock(rb_nativethread_lock_t *lock)
{
-#if USE_WIN32_MUTEX
return w32_mutex_lock(lock->mutex, true);
#else
return TryEnterCriticalSection(&lock->crit) == 0 ? EBUSY : 0;
@@ -342,7 +342,7 @@ rb_native_mutex_trylock(rb_nativethread_lock_t *lock)
void
rb_native_mutex_unlock(rb_nativethread_lock_t *lock)
{
-#if USE_WIN32_MUTEX
thread_debug("release mutex: %p\n", lock->mutex);
ReleaseMutex(lock->mutex);
#else
@@ -353,7 +353,7 @@ rb_native_mutex_unlock(rb_nativethread_lock_t *lock)
void
rb_native_mutex_initialize(rb_nativethread_lock_t *lock)
{
-#if USE_WIN32_MUTEX
lock->mutex = w32_mutex_create();
/* thread_debug("initialize mutex: %p\n", lock->mutex); */
#else
@@ -364,7 +364,7 @@ rb_native_mutex_initialize(rb_nativethread_lock_t *lock)
void
rb_native_mutex_destroy(rb_nativethread_lock_t *lock)
{
-#if USE_WIN32_MUTEX
w32_close_handle(lock->mutex);
#else
DeleteCriticalSection(&lock->crit);