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
no longer an alias of pthread_cond_t.
* thread_pthread.c: adapt new rb_thread_cond_t type.
* thread.c (mutex_alloc): ditto.
* thread_win32.c (native_cond_initialize): ditto.
* configure.in: add check for pthread_cond_attr_setclock() and
clockid_t type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
APIs to modularize GVL implementation.
* thread_pthread.c, thread_pthread.h: Two GVL implementations.
(1) Simple locking GVL which is same as existing GVL.
(2) Wake-up queued threads. The wake-up order is simple FIFO.
(We can make several queues to support exact priorities, however
this causes some issues such as priority inversion and so on.)
This impl. prevents spin-loop (*1) caused on SMP environemnts.
*1: Only one Ruby thread acqures GVL again and again.
Bug #2359 [ruby-core:26694]
* thread_win32.c, thread_win32.h: Using simple lock
not by CRITICAL_SECTION but by Mutex.
Bug #3890 [ruby-dev:42315]
* vm.c (ruby_vm_destruct): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
patched by KOSAKI Motohiro [ruby-dev:40309]
* thread_pthread.c (ruby_init_stack): use get_stack
on platforms which have pthread_attr_get_np.
(FreeBSD, DragonFlyBSD and NetBSD)
This is because FreeBSD and DragonFly BSD must use
pthread_attr_get_np to get stack size of main thread,
but Mac OS X and Linux with LinuxThreads must use getrlimit.
<http://www.nminoru.jp/~nminoru/programming/stackoverflow_handling.html>
<http://d.hatena.ne.jp/nurse/20100204>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
prefixed include guards with RUBY.
* id.h: added include guard.
* regenc.h, regint.h, regparse.h: prefixed include guards with
ONIGURUMA.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
thread_win32.c: make some functions static functions.
a patch from Tadashi Saito <shiba AT mail2.accsnet.ne.jp>
in [ruby-core:14407]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread_win32.ci, thread_win32.h, thread_pthread.ci, thread_pthread.h:
prepare native_cond_*() which are based on pthread_cond_*() spec.
* prelude.rb: fix Mutex#synchronize method.
* vm_core.h, include/ruby/intern.h: change unblock function interface
(to pass some user data).
* file.c, process.c: ditto.
* benchmark/bm_vm2_mutex.rb: add a benchmark for mutex.
* benchmark/bm_vm3_thread_mutex.rb: add a benchmark for mutex
with contension.
* benchmark/run.rb: fix to remove ENV['RUBYLIB'] for matzruby.
* test/ruby/test_thread.rb: add a test.
* common.mk: fix benchmark options.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
move cleanup function to thread_start_func_2().
* thread.c, thread_pthread.ci, thread_win32.ci:
add more destruct functions.
(native_thread_destroy() and native_mutex_destroy())
* thread_pthread.ci, thread_pthread.h: make native_mutex_* functions
(check error, etc), it's not macro any more.
* thread_win32.ci (thread_start_func_1): store some values before
running thread (to release these after running thread).
* thread_win32.ci (native_thread_create): fix spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e