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
@ -322,7 +322,7 @@ native_sleep(rb_thread_t *th, rb_hrtime_t *rel)
|
|||||||
void
|
void
|
||||||
rb_native_mutex_lock(rb_nativethread_lock_t *lock)
|
rb_native_mutex_lock(rb_nativethread_lock_t *lock)
|
||||||
{
|
{
|
||||||
#if USE_WIN32_MUTEX
|
#ifdef USE_WIN32_MUTEX
|
||||||
w32_mutex_lock(lock->mutex, false);
|
w32_mutex_lock(lock->mutex, false);
|
||||||
#else
|
#else
|
||||||
EnterCriticalSection(&lock->crit);
|
EnterCriticalSection(&lock->crit);
|
||||||
@ -332,7 +332,7 @@ rb_native_mutex_lock(rb_nativethread_lock_t *lock)
|
|||||||
int
|
int
|
||||||
rb_native_mutex_trylock(rb_nativethread_lock_t *lock)
|
rb_native_mutex_trylock(rb_nativethread_lock_t *lock)
|
||||||
{
|
{
|
||||||
#if USE_WIN32_MUTEX
|
#ifdef USE_WIN32_MUTEX
|
||||||
return w32_mutex_lock(lock->mutex, true);
|
return w32_mutex_lock(lock->mutex, true);
|
||||||
#else
|
#else
|
||||||
return TryEnterCriticalSection(&lock->crit) == 0 ? EBUSY : 0;
|
return TryEnterCriticalSection(&lock->crit) == 0 ? EBUSY : 0;
|
||||||
@ -342,7 +342,7 @@ rb_native_mutex_trylock(rb_nativethread_lock_t *lock)
|
|||||||
void
|
void
|
||||||
rb_native_mutex_unlock(rb_nativethread_lock_t *lock)
|
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);
|
thread_debug("release mutex: %p\n", lock->mutex);
|
||||||
ReleaseMutex(lock->mutex);
|
ReleaseMutex(lock->mutex);
|
||||||
#else
|
#else
|
||||||
@ -353,7 +353,7 @@ rb_native_mutex_unlock(rb_nativethread_lock_t *lock)
|
|||||||
void
|
void
|
||||||
rb_native_mutex_initialize(rb_nativethread_lock_t *lock)
|
rb_native_mutex_initialize(rb_nativethread_lock_t *lock)
|
||||||
{
|
{
|
||||||
#if USE_WIN32_MUTEX
|
#ifdef USE_WIN32_MUTEX
|
||||||
lock->mutex = w32_mutex_create();
|
lock->mutex = w32_mutex_create();
|
||||||
/* thread_debug("initialize mutex: %p\n", lock->mutex); */
|
/* thread_debug("initialize mutex: %p\n", lock->mutex); */
|
||||||
#else
|
#else
|
||||||
@ -364,7 +364,7 @@ rb_native_mutex_initialize(rb_nativethread_lock_t *lock)
|
|||||||
void
|
void
|
||||||
rb_native_mutex_destroy(rb_nativethread_lock_t *lock)
|
rb_native_mutex_destroy(rb_nativethread_lock_t *lock)
|
||||||
{
|
{
|
||||||
#if USE_WIN32_MUTEX
|
#ifdef USE_WIN32_MUTEX
|
||||||
w32_close_handle(lock->mutex);
|
w32_close_handle(lock->mutex);
|
||||||
#else
|
#else
|
||||||
DeleteCriticalSection(&lock->crit);
|
DeleteCriticalSection(&lock->crit);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user