diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-23 09:53:14 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-23 09:53:14 +0000 |
commit | bd058912da6ffef92a50fe759b1bae210ec82ea4 (patch) | |
tree | 6acbe02fa09f9dd60974ef76c5147dcfbab83718 /thread.c | |
parent | 374219291946885509dac502230c1084b0058238 (diff) |
* thread_native.h: added.
Move native thread related lines from vm_core.h.
And declare several functions "rb_nativethread_lock_*",
manipulate locking.
* common.mk: add thread_native.h.
* thread.c: add functions "rb_nativethread_lock_*".
* thraed.c, thread_[pthread,win32].[ch]: rename rb_thread_lock_t
to rb_nativethread_lock_t to make it clear that this lock is for
native thraeds, not for ruby threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -241,7 +241,7 @@ static void timer_thread_function(void *); #if THREAD_DEBUG static int debug_mutex_initialized = 1; -static rb_thread_lock_t debug_mutex; +static rb_nativethread_lock_t debug_mutex; void rb_thread_debug( @@ -277,17 +277,29 @@ rb_vm_gvl_destroy(rb_vm_t *vm) } void -rb_thread_lock_unlock(rb_thread_lock_t *lock) +rb_nativethread_lock_initialize(rb_nativethread_lock_t *lock) { - native_mutex_unlock(lock); + native_mutex_initialize(lock); } void -rb_thread_lock_destroy(rb_thread_lock_t *lock) +rb_nativethread_lock_destroy(rb_nativethread_lock_t *lock) { native_mutex_destroy(lock); } +void +rb_nativethread_lock_lock(rb_nativethread_lock_t *lock) +{ + native_mutex_lock(lock); +} + +void +rb_nativethread_lock_unlock(rb_nativethread_lock_t *lock) +{ + native_mutex_unlock(lock); +} + static int set_unblock_function(rb_thread_t *th, rb_unblock_function_t *func, void *arg, struct rb_unblock_callback *old, int fail_if_interrupted) @@ -375,7 +387,7 @@ terminate_i(st_data_t key, st_data_t val, rb_thread_t *main_thread) typedef struct rb_mutex_struct { - rb_thread_lock_t lock; + rb_nativethread_lock_t lock; rb_thread_cond_t cond; struct rb_thread_struct volatile *th; int cond_waiting; |