summaryrefslogtreecommitdiff
path: root/thread_pthread.c
AgeCommit message (Collapse)Author
2011-05-08* thread_pthread.c (native_cond_timedwait): add to care EINTR.kosaki
* thread_pthread.c (thread_timer): remove EINTR check. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-08revert r31474. we cann't call xmalloc under FGLOCK.kosaki
Thansk, nagachika-san. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-08* thread_pthread.c (add_signal_thread_list): use xmalloc insteadkosaki
of malloc. * thread_pthread.c (remove_signal_thread_list): use xfree instead of free. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-08* thread_pthread.c: cleanup signal_thread_list related ifdef.kosaki
1) we don't have to use #ifdef FOO-PLATFORM directly 2) About half #ifdef didn't care symbian properly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-07* thread_pthread.c (USE_MONOTONIC_COND): check the availabilitynobu
more strictly. * thread_pthread.h (rb_thread_cond_t): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-06sleep_cond use monotonic time if possible.kosaki
* thread_pthread.c (native_thread_init): change sleep_cond attribute to monotonic. * thread_pthread.c (native_sleep): use native_cond_timeout(). * thread_pthread.c (native_cond_timeout): add overflow care. * thread_win32.c (native_cond_timeout): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-06 fix win32 compile error.kosaki
* thread_win32.c (RB_CONDATTR_CLOCK_MONOTONIC): define RB_CONDATTR_CLOCK_MONOTONIC always. * thread_pthread.c (RB_CONDATTR_CLOCK_MONOTONIC): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-06 mutex: deadlock check timeout use monotonic time.kosaki
* thread_pthread.c (native_cond_timeout): new internal api. it calculate a proper time for argument of native_cond_timedwait(). * thread_win32.c (native_cond_timeout): ditto. * thread_pthread.c (thread_timer): use native_cond_timeout() instead of get_ts. * thread.c (lock_func): ditto. * thread_pthread.c (get_ts): removed. use native_cond_timeout(). * thread.c (init_lock_timeout): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-06* thread_pthread.c (get_ts): add monotonic clock capability.kosaki
* thread_pthread.c (rb_thread_create_timer_thread): use monotonic clock if possible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-06* thread_pthread.h (rb_thread_cond_t): add clockid field. it'skosaki
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
2011-05-05* thread_pthread.c (native_mutex_reinitialize_atfork): removedkosaki
unused macro. * thread_win32.c (native_mutex_reinitialize_atfork): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-29* thread_pthread.c (gvl_init): fix hangup if GVL_SIMPLE_LOCK=1.kosaki
We don't have to call mutex_unlock() before initialize it! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-25* random.c (random_rand): remove unused variables.naruse
* struct.c (rb_struct_define_without_accessor): ditto. * strftime.c (rb_strftime_with_timespec): ditto. * sprintf.c: ditto. * time.c (time_asctime): remove useless GetTimeval(). * thread_pthread.c: cast to (void *) for %p. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-06* thread_pthread.c (register_cached_thread_and_wait): move invalidnobu
storage class function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-20 * thread.c (thread_cleanup_func): Moved interrupted_lockkosaki
destroying code from native_thread_destroy() to thread_cleanup_func() because it's platform independent logic. * thread_win32.c (native_thread_destroy): ditto. * thread_pthread.c (native_thread_destroy): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-20 * thread_pthread.c (native_thread_destroy): Fixed gvl_cond leak.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-28* thread_pthread.c (NATIVE_MUTEX_LOCK_DEBUG): move and use it.ko1
* ChangeLog: fix my timezone. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-28* thread_pthread.c: remove pthread_atfork().ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-28* thread_pthread.c (native_cond_*): Check return code.ko1
(Some OSs except Linux return error code). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-28* thread_pthread.c (thread_start_func_1): initialize native threadnobu
data immediately before starting. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-28* thread_pthread.c (gvl_release, gvl_init): suppress warnings.nobu
* vm_core.h (rb_vm_gvl_destroy): add prototype. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-28* thread_pthread.c (gvl_reinit): register atfork hander only innobu
the parent process, to get rid of dead lock. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-27* thread.c, vm_core.h: make gvl_acquire/release/init/destructko1
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
2010-08-19* thread_pthread.c (native_sleep): suppress a warning for platformsakr
which time_t is int. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-22* thread_pthread.c (get_stack): fix memory leak; pthread_attr_destorymame
must be called even when pthread_getattr_np is used. [ruby-core:31269] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-01* thread_pthread.c (thread_start_func_1): don't callnaruse
native_thread_init_stack(th) on cygwin to avoid the segv introduced by r27789. Cygwin's signal implementation is half baked so USE_SIGNALSTACK is not defined and it needs another treatment. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-29 * thread_pthread.c (get_stack): use pthread_getthrds_np() for AIX.kanemoto
* configure.in: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-05* vm.c (Init_BareVM): call Init_native_thread here.akr
* thread.c (Init_Thread): don't call Init_native_thread. * thread_pthread.c (Init_native_thread): exported. * thread_win32.c (Init_native_thread): ditto. [ruby-dev:41536] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-13* vm_core.c (rb_thread_struct): add a field for sigaltstack.mame
* thread_pthread.c (thread_start_func_1): initialize machine stack information. * thread.c (thread_start_func_2): set sigaltstack for each sub thread. [ruby-core:24540] [ruby-core:30207] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-08* cont.c (stackgrowdirection): removed duplicated code, usenobu
STACK_UPPER macro instead. * gc.h (STACK_DIR_UPPER): moved from thread_pthread.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-14* gc.c (GET_STACK_BOUNDS): fixed macro argument names. a patch fromnobu
Satoshi Shiba <shiba AT rvm.jp> at [ruby-dev:40973]. * gc.h (ruby_get_stack_grow_direction): fixed prototype. * thread_pthread.c (get_stack, ruby_stack_overflowed_p): both side should be same type. [Bug #3145] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-04* thread_pthread.c (native_thread_init_stack): use get_stack.naruse
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
2010-02-03* thread_pthread.c: DragonFlyBSD is also the same as FreeBSDnaruse
on getting the stack size of the main thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-03* thread_pthread.c (ruby_init_stack): use pthread_get_attr_npnaruse
to get the stack size of the main thread on FreeBSD. * thread_pthread.c: include pthread_np.h on FreeBSD. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-05removes the dtrace support. reverts r26239, r26238 and r26235.yugui
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-03* trace.h: new file. wraps tracing mechanisms.yugui
* defs/dtrace.d: new file. defined a dtrace provider "ruby". * include/ruby/ruby.h (LIKELY): moved from vm.c. (UNLIKELY): ditto. (OBJSETUP): probe "object-create". (RUBY_EVENT_RESCUE): new event. * vm_exec.c (DEBUG_ENTER_INSN): embeded a probe insn-entry into it. (DEBUG_END_INSN): insn-return. * vm.c (LIKELY): moved into ruby.h. (UNLIKELY): ditto. (Init_BareVM): embeded a probe "raise" into it. * variable.c (rb_class2name_without_alloc): new utility function. * tool/rbinstall.rb (install?(:ext, :arch, :'ext-arch')): installs dtrace.d if necessary. * thread_pthread.c (add_signal_thread_list): probe "raise". (rb_thread_create_timer_thread): ditto. * thread.c (rb_thread_schedule_rec): probes "thread-enter" and "thread-leave", (thread_start_func_2): ditto. (thread_cleanup_func): probe "thread-term" * lib/mkmf.rb: supports dtrace postprocessor on making an extension. * iseq.c (rb_vm_insn_name): new utility function. (rb_vm_insn_len): ditto. * insns.def (hook): probes "method-etnry", "method-return", "line", and "rescue". * compile.c (iseq_compile_each): adds a trace op for "rescue" probe. * gc.c (garbage_collect): probes "gc-begin" and "gc-end". (obj_free): probe "object-free" (garbage_collect_with_gvl): probe "raise" (negative_size_allocation_error): ditto. (rb_memerror): ditto. * eval.c (rb_rescue2): probe "rescue" (rb_longjmp): probe "raise" * ext/probe/probe.c: new extension for application defined probes. * ext/probe/extconf.rb: ditto. * configure.in (--with-tracing-model): new option to choose a tracing mechanism. (DTRACE): new substitution. name of dtrace(1). (RUBY_TRACING_MODEL): new substitution. (DTRACE_OBJ): ditto. (MINIDTRACE_OBJ): ditto. (GOLFDTRACE_OBJ): ditto. (LIBRUBY_DTRACE_OBJ): ditto. (RUBY_DTRACE_POSTPROCESS): new macro. checks whether the dtrace on the system needs postprocessing. (RUBY_DTRACE_BSD_BROKEN): new macro. checks whether the dtrace supports USDT. * Makefile.in: (DTRACE): new variable. name of dtrace(1). (TRACING_MODEL): new variable. name of the chosen tracing mechanism. (DTRACE_OBJ): same as the one in configure.in. (MINIDTRACE_OBJ): ditto. (GOLFDTRACE_OBJ): ditto. (LIBRUBY_DTRACE_OBJ): ditto. (CPPOUTFILE): new substitution. necessary for generating dtrace.d (trace_none.h): new target for TRACING_MODEL=none (RUBY_H_INCLUDES): appended a header for tracing. (distclean-local): also removes preprocessed version of dtrace.d ($(LIBRUBY_A)): needs $(LIBRUBY_DTRACE_OBJ) if dtrace needs postprocessing. ($(PROGRAM)): ditto. (golf): ditto. (miniruby): ditto. ($(arch_hdrdir)/ruby/dtrace.d): new target. preprocessed verson of defs/dtrace.d. generated if necessary. ($(arch_hdrdir)/ruby/trace_dtrace.h): new target. definition of probes. ($(LIBRUBY_DTRACE_OBJ)): new target. generated if dtrace needs postprocessing. ($(DTRACE_OBJ)): ditto. ($(MINIDTRACE_OBJ)): ditto. ($(GOLFDTRACE_OBJ)): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-10* thread_pthread.c (native_mutex_reinitialize_atfork): release andnobu
re-acquire the lock at re-initialization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24* include/ruby/ruby.h (rb_bug_errno): declared.akr
* include/ruby/intern.h (rb_strerrno): declaration removed. * error.c (rb_strerrno): make it static. return NULL for unknown errors. (rb_bug_errno): defined. * thread_pthread.c: use rb_bug_errno. * signal.c (ruby_signal): use rb_bug_errno. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24* include/ruby/intern.h (rb_strerrno): declared.akr
* template/known_errors.inc.tmpl: generate defined_error() and undefined_error() instead of set_syserr. * error.c (Init_syserr): define defined_error() and undefined_error() to follow the above change. (rb_strerrno): defined. * thread_pthread.c: show error message and errno macro name with rb_bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-23* thread_pthread.c (RUBY_STACK_MIN, RUBY_STACK_SPACE): delay fornobu
platforms where PTHREAD_STACK_MIN is not compile time constant. [ruby-dev:39751] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-18* thread.c (rb_thread_atfork_internal): reinitialize global locknobu
at fork to get rid of deadlock. based on the patch from Hongli Lai in [ruby-core:26783]. [ruby-core:26361] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-12* thread_pthread.c: removed last comma of enum.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-12* thread.c (thread_create_core): moved failure handling fromnobu
native_thread_core(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-12* thread_pthread.c (native_thread_create): constified.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-02* thread_pthread.c (native_stop_timer_thread): delay joinning timerusa
thread after unlocking mutex. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-02* thread_pthread.c (native_stop_timer_thread): need to join timer threadusa
only when really stopping it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-02* thread_{pthread,win32}.c (native_stop_timer_thread): join the threadusa
here. * thread_{pthread,win32}.c (native_reset_timer_thread): new function. * thread.c (rb_thread_stop_timer_thread, rb_thread_reset_timer_thread): call above function instead of simply seting 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-07* thread_pthread.c (rb_thread_create_timer_thread): print fatal errorko1
message to stderr instead of using rb_bug(). * KNOWNBUGS.rb, bootstraptest/test_fork.rb: move a fixed test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-19* eval.c (ruby_cleanup): the order of local variables on stack isnobu
undefined. should use outermost VALUE for ruby_init_stack. * gc.c (ruby_get_stack_grow_direction, Init_stack): allows volatile pointer. * thread_*.c (ruby_init_stack): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-11* thread_pthread.c (ruby_init_stack): range of rlim_cur may benobu
larger than int. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e