summaryrefslogtreecommitdiff
path: root/thread_pthread.c
AgeCommit message (Collapse)Author
2015-06-11* configure.in: define SET_THREAD_NAME if it has pthread_set_name_npnaruse
for FreeBSD, and don't define it if both pthread_setname_np and pthread_set_name_np don't exist. * thread_pthread.c (SET_THREAD_NAME): don't define if they don't exist. * thread_pthread.c (native_set_thread_name): run if SET_THREAD_NAME is defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-14thread_pthread.c: keep sp safe zonenobu
* thread_pthread.c (reserve_stack): keep sp safe zone to get rid of crash by -fstack-check. [ruby-core:68740] [Bug #11030] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-01thread_pthread.c: use rb_pid_tnobu
* thread_pthread.c (timer_thread_pipe.owner_process): process ID should be pid_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-31thread_pthread.c: Fix intermittent SIGBUS on Linuxnobu
* thread_pthread.c (reserve_stack): fix intermittent SIGBUS on Linux, by reserving the stack virtual address space at process start up so that it will not clash with the heap space. [Fix GH-822] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-28thread.c: micro-optimize thread create/joinnormal
* thread.c (struct join_arg): restructure and make smaller (thread_join_sleep): avoid timeofday() call if forever (thread_join): pass join_arg.delay directly (rb_thread_inspect_msg): remove, inline into rb_thread_inspect (rb_thread_inspect): reduce branching and string creation * thread_pthread.c (native_set_thread_name): create string directly to avoid reparsing. [Misc #10723] This reduces time in benchmark/bm_vm_thread_create_join.rb by a few percent. Minor improvements only: target 0: 2.1.5 (ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]) target 1: trunk (ruby 2.3.0dev (2015-01-16 trunk 49282) [x86_64-linux]) target 2: built (ruby 2.3.0dev (2015-01-16 trunk 49282) [x86_64-linux]) benchmark results: minimum results in each 3 measurements. Execution time (sec) name 2.1.5 trunk built vm_thread_create_join 1.049 1.242 1.138 Speedup ratio: compare with the result of `2.1.5' (greater is better) name trunk built vm_thread_create_join 0.845 0.923 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-21* thread_pthread.c (native_set_thread_name): New function toakr
set thread name visible with ps command on GNU/Linux. Ex. ps -o %c -L * thread.c (thread_start_func_2): Call native_set_thread_name at beginning. (rb_thread_inspect_msg): Extract from rb_thread_inspect. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-04* symbian/*: removed Symbian support.hsbt
[Feature #10199][ruby-core:64725] * dln.c: ditto. * include/ruby/defines.h: ditto. * thread_pthread.c: ditto. * vm.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-15thread_pthread: prefer rb_nativethread* types/functionsnormal
This will make it easier for us to try alternative mutex/condvar implementations while still using pthreads for thread management. [Feature #10134] * thread_pthread.h: define RB_NATIVETHREAD_LOCK_INIT and RB_NATIVETHREAD_COND_INIT macros * thread_pthread.c (native_mutex_lock, native_mutex_unlock, native_mutex_trylock, native_mutex_initialize, native_mutex_destroy, native_cond_wait): use rb_nativethread_lock_t instead of pthread_mutex_t * thread_pthread.c (native_mutex_debug): make argument type-agnostic to avoid later cast. * thread_pthread.c (register_cached_thread_and_wait): replace PTHREAD_COND_INITIALIZER with RB_NATIVETHREAD_COND_INIT, use native_mutex_{lock,unlock} * thread_pthread.c (use_cached_thread): use native_mutex_{lock,unlock} * thread_pthread.c (native_sleep): use rb_nativethread_lock_t to match th->interrupt_lock, use native_mutex_{lock,unlock} * thread_pthread.c (timer_thread_lock): use rb_nativethread_lock_t type git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-11thread.c: fix for non-scalar pthread_tnobu
* configure.in (rb_cv_scalar_pthread_t): pthread_t is not required to be a scalar type. * thread.c (fill_thread_id_string, thread_id_str): dump pthread_t in hexadecimal form if it is not a scalar type, assume it can be represented in a pointer form otherwise. based on the patch by Rei Odaira at [ruby-core:62867]. [ruby-core:62857] [Bug #9884] * thread_pthread.c (Init_native_thread, thread_start_func_1), (native_thread_create): set thread_id_str if needed. * vm_core.h (rb_thread_t): add thread_id_string if needed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-11thread_pthread.c: timer thread flagnobu
* thread_pthread.c (timer_thread): add a flag to tell timer thread is created, since 0 may be a valid value as pthread_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-10thread_pthread.c: variable for errnonobu
* thread_pthread.c (rb_thread_wakeup_timer_thread_fd): use a local variable for errno. * thread_pthread.c (consume_communication_pipe): ditto. add EWOULDBLOCK case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-10thread_pthread.c: timer_thread_pipe structnobu
* thread_pthread.c (timer_thread_pipe): aggregate timer thread pipe stuff into a struct. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-10thread_pthread.c: compare with pthread_equalnobu
* thread_pthread.c (ubf_select): compare thread_id with pthread_equal() but not directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-10thread_pthread.c: variable for errnonobu
* thread_pthread.c (timer_thread_sleep): use a local variable for errno. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-09thread_*.c: constifynobu
* thread_{pthread,win32}.c (native_cond_timedwait): constify. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-27configure.in: define SET_THREAD_NAMEnobu
* configure.in (SET_THREAD_NAME): define according to pthread_setname_np variations. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-13configure.in: use pthread_setname_np only if availablenobu
* configure.in: check if pthread_setname_np is available. * thread_pthread.c: pthread_setname_np is not available on old Darwins. [ruby-core:60524] [Bug #9492] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-28thread_pthread.c: use get_stacknobu
* thread_pthread.c (ruby_init_stack, ruby_stack_overflowed_p): place get_stack above others to get stack boundary information. [ruby-core:60113] [Bug #9454] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-28* thread_pthread.c: rlimit is only available on Linux.naruse
At least r44712 breaks FreeBSD. [ruby-core:60113] [Bug #9454] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-28vm_core.h: rb_thread_struct::machinenobu
* vm_core.h (rb_thread_struct): aggregate cpu stuff into a struct, so that a debugger can show its content at once. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-27thread_pthread.c: cast to size_tnobu
* thread_pthread.c (ruby_stack_overflowed_p): range of rlim_cur may be larger than size_t. [ruby-core:60113] [Bug #9454] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-27thread_pthread.c: get current main thread stack sizenobu
* thread_pthread.c: get current main thread stack size, which may be expanded than allocated size at initialization, by rlimit(). [ruby-core:60113] [Bug #9454] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-21thread_pthread.c: fix for dynamic PTHREAD_STACK_MINnobu
* thread_pthread.c (rb_thread_create_timer_thread): fix for platforms where PTHREAD_STACK_MIN is a dynamic value and not a compile-time constant. [ruby-dev:47911] [Bug #9436] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-21* thread_pthread.c (rb_thread_create_timer_thread): fix missing paren.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-21thread_pthread.c: expand timer thread stack sizenobu
* thread_pthread.c (rb_thread_create_timer_thread): expand timer thread stack size to get rid of segfault on FreeBSD/powerpc64. based on the patch by Steve Wills at [ruby-core:59923]. [ruby-core:56590] [Bug #8783] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-21thread_pthread.c: timer thread stack sizenobu
* thread_pthread.c (rb_thread_create_timer_thread): define the stack size for timer thread at compile time. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-18thread_pthread.c: use get_main_stack properlynobu
* thread_pthread.c (ruby_init_stack): set stack_start properly by get_main_stack() if possible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-16* thread_pthread.c (rb_thread_create_timer_thread): Show errorakr
message instead of error number. * cont.c (fiber_machine_stack_alloc): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-03thread_pthread.c: set thread namenobu
* thread_pthread.c (thread_timer): set timer thread name on OSX too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-03thread_pthread.c: fix compile error on HP-UXnobu
* thread_pthread.c (sys/dyntune.h): for gettune(). * thread_pthread.c (hpux_attr_getstackaddr): fix missing *. [ruby-core:56983] [Feature #8793] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-30thread_pthread.c: fill stack info by creator threadnobu
* thread_pthread.c (native_thread_init_stack): wait the creator thread to fill machine stack info, if get_stack_of() is available. * thread_pthread.c (native_thread_create): fill the created thread stack info after starting, if get_stack_of() is available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-30thread_pthread.c: define attr only if usednobu
* thread_pthread.c (native_thread_create): define attr only if it is used, and merge pthread_create() calls. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-30thread_pthread.c: get_main_stacknobu
* thread_pthread.c (get_main_stack): separate function to get stack of main thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-30thread_pthread.c: fix vps_pagesizenobu
* thread_pthread.c (hpux_attr_getstackaddr): vps_pagesize is defaulted to 16 and in Kbytes. [ruby-core:56863] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-28thread_pthread.c: get_stack on HP-UXnobu
* thread_pthread.c (hpux_attr_getstackaddr): basic support for the get_stack() under HP-UX. based on the patch by michal@rokos.cz (Michal Rokos) at [ruby-core:56645]. [Feature #8793] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-28thread_pthread.c: dup codenobu
* thread_pthread.c (get_stack): merge duplicated code split by ifdef. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-28thread_pthread.c: simplifynobu
* thread_pthread.c (register_cached_thread_and_wait): simplify and reduce branches. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-23* thread_(pthread|win32).h: rename rb_thread_cond_t toko1
rb_nativethread_cond_t. * thread.c, thread_pthread.c, thread_win32.c, vm_core.h: catch up renaming. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-23* thread_native.h: add rb_nativethread_self() which returnsko1
current running native thread identifier. * thread_[pthread|win32].c: implement rb_nativethread_self(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-23* thread_pthread.h, thread_win32.h: rename rb_thread_id_t toko1
rb_nativethread_id_t. * thread_pthread.c, vm_core.h: use rb_nativethread_id_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-23* thread_native.h: added.ko1
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
2013-06-07* internal.h (numberof): Gathered from various files.akr
* array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c, load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c, error.c, ruby.c: Remove the definitions of numberof. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-27* thread_pthread.c (ruby_init_stack): Add STACK_GROW_DIR_DETECTION.akr
This fixes a compilation failure while cross-compiling for Tensilica Xtensa Processor. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-26* thread_pthread.c (ruby_init_stack): Add STACK_GROW_DIR_DETECTION.akr
This fixes a compilation failure while cross-compiling for ARM. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04* thread_pthread.c: Fixes wrong scopes of #if USE_SLEEPY_TIMER_THREADyugui
.. #endif sections. This fixes a build error on NativeClient. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04* thread_pthread.c (ruby_init_stack): Avoid using uninitialized value.yugui
stackaddr and size are not set if get_stack() fails. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-30timev.h: move time_t stuffsnobu
* timev.h (TYPEOF_TIMEVAL_TV_SEC, unsigned_time_t): move from time.c. * thread.c: use definitions in timev.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-27thread_pthread.c: poll.h is already includednobu
* thread_pthread.c (poll.h): already included in ruby/io.h from thread.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-26* internal.h: Define TIMET_MAX and TIMET_MIN here.akr
* time.c: Remove TIMET_MAX and TIMET_MIN definitions. * thread.c: Ditto. * thread_pthread.c: Remove TIMET_MAX definition. * thread_win32.c: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-16* configure.in: check struct timeval exist or not.kosaki
* include/ruby/missing.h (struct timeval): check HAVE_STRUCT_TIMEVAL properly. and don't include sys/time.h if struct timeval exist. * file.c: include sys/time.h explicitly. * random.c: ditto. * thread_pthread.c: ditto. * time.c: ditto. * ext/date/date_strftime.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e