summaryrefslogtreecommitdiff
path: root/thread_win32.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2021-05-04 23:57:24 +0000
committerPeter Zhu <peter@peterzhu.ca>2021-05-04 20:38:03 -0400
commit46dd295a53640a5ccf21688a5539ac50e17008f6 (patch)
treeceb358b0eda8940f53c2a196d1c2ccb053b3b239 /thread_win32.c
parent3d2e7e2ab5b08625efaa4d1b2b3b127d87e8dad5 (diff)
Fix compilation error in thread_win32.c
USE_WIN32_MUTEX flag may not be defined.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4457
Diffstat (limited to 'thread_win32.c')
-rw-r--r--thread_win32.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/thread_win32.c b/thread_win32.c
index 04c48653c5..8b5120be3c 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -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
+#ifdef 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
+#ifdef 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
+#ifdef 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
+#ifdef 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
+#ifdef USE_WIN32_MUTEX
w32_close_handle(lock->mutex);
#else
DeleteCriticalSection(&lock->crit);