mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix compilation error in thread_win32.c
USE_WIN32_MUTEX flag may not be defined.
This commit is contained in:
parent
3d2e7e2ab5
commit
46dd295a53
Notes:
git
2021-05-05 09:38:22 +09:00
1 changed files with 5 additions and 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
|
||||
#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);
|
||||
|
|
Loading…
Reference in a new issue