summaryrefslogtreecommitdiff
path: root/thread_win32.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-17 07:21:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-17 07:21:03 +0000
commitcdeff42cc1838fe71d562c6bd96e2437a3e90170 (patch)
tree38b7ec8772ed4c341d722cd6f7c2ac2e9257a479 /thread_win32.c
parent3c5664563446185c0b7d95de013d47b766122ba8 (diff)
downloadruby-cdeff42cc1838fe71d562c6bd96e2437a3e90170.tar.gz
thread_win32.h: rb_thread_lock_t for USE_WIN32_MUTEX
* thread_win32.h (rb_thread_lock_t): make a union for USE_WIN32_MUTEX. this internal is used only in thread_win32.c, but has to be complete to define rb_thread_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_win32.c')
-rw-r--r--thread_win32.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/thread_win32.c b/thread_win32.c
index b77fdbb9a6..c8da1f9f87 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -340,9 +340,9 @@ static int
native_mutex_lock(rb_thread_lock_t *lock)
{
#if USE_WIN32_MUTEX
- w32_mutex_lock(*lock);
+ w32_mutex_lock(lock->mutex);
#else
- EnterCriticalSection(lock);
+ EnterCriticalSection(&lock->crit);
#endif
return 0;
}
@@ -351,10 +351,10 @@ static int
native_mutex_unlock(rb_thread_lock_t *lock)
{
#if USE_WIN32_MUTEX
- thread_debug("release mutex: %p\n", *lock);
- return ReleaseMutex(*lock);
+ thread_debug("release mutex: %p\n", lock->mutex);
+ return ReleaseMutex(lock->mutex);
#else
- LeaveCriticalSection(lock);
+ LeaveCriticalSection(&lock->crit);
return 0;
#endif
}
@@ -364,8 +364,8 @@ native_mutex_trylock(rb_thread_lock_t *lock)
{
#if USE_WIN32_MUTEX
int result;
- thread_debug("native_mutex_trylock: %p\n", *lock);
- result = w32_wait_events(&*lock, 1, 1, 0);
+ thread_debug("native_mutex_trylock: %p\n", lock->mutex);
+ result = w32_wait_events(&lock->mutex, 1, 1, 0);
thread_debug("native_mutex_trylock result: %d\n", result);
switch (result) {
case WAIT_OBJECT_0:
@@ -375,7 +375,7 @@ native_mutex_trylock(rb_thread_lock_t *lock)
}
return EINVAL;
#else
- return TryEnterCriticalSection(lock) == 0;
+ return TryEnterCriticalSection(&lock->crit) == 0;
#endif
}
@@ -383,10 +383,10 @@ static void
native_mutex_initialize(rb_thread_lock_t *lock)
{
#if USE_WIN32_MUTEX
- *lock = w32_mutex_create();
- /* thread_debug("initialize mutex: %p\n", *lock); */
+ lock->mutex = w32_mutex_create();
+ /* thread_debug("initialize mutex: %p\n", lock->mutex); */
#else
- InitializeCriticalSection(lock);
+ InitializeCriticalSection(&lock->crit);
#endif
}
@@ -394,9 +394,9 @@ static void
native_mutex_destroy(rb_thread_lock_t *lock)
{
#if USE_WIN32_MUTEX
- w32_close_handle(*lock);
+ w32_close_handle(lock->mutex);
#else
- DeleteCriticalSection(lock);
+ DeleteCriticalSection(&lock->crit);
#endif
}