summaryrefslogtreecommitdiff
path: root/thread_pthread.c
AgeCommit message (Collapse)Author
2016-03-29merge revision(s) 54256: [Backport #12118] [Backport #12218]usa
* thread_pthread.c (reserve_stack): fix reserving position where the stack growing bottom to top. [Bug #12118] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@54394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-25merge revision(s) 54000: [Backport #12148]usa
* thread_pthread.c (getstack): __pi_stacksize returned by pthread_getthrds_np() is wrong on AIX. Use __pi_stackend - __pi_stackaddr instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@54264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-29merge revision(s) 51626: [Backport #11457]usa
* thread_pthread.c (reserve_stack): ensure the memory is really allocated. [Bug #11457] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@51975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-28merge revision(s) 50316: [Backport #11030]usa
* 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/branches/ruby_2_1@50396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-13merge revision(s) 49452: [Backport #10813]usa
* 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/branches/ruby_2_1@50289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-19merge revision(s) r44712,r44715,r44716,r44722,r44725,r44726,r44753: ↵nagachika
[Backport #9454] [Backport #9828] * 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] * thread_pthread.c: rlimit is only available on Linux. At least r44712 breaks FreeBSD. [ruby-core:60113] [Bug #9454] * 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/branches/ruby_2_1@46468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-07merge revision(s) r45190,r45202,r45204,r45713: [Backport #9586]nagachika
configure.in: define SET_THREAD_NAME * configure.in (SET_THREAD_NAME): define according to pthread_setname_np variations. * configure.in: correct pthread_setname_np's prototype on NetBSD. [Bug #9586] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-22merge revision(s) 44670,44671,44673,44675: [Backport #8783]naruse
thread_pthread.c: timer thread stack size * thread_pthread.c (rb_thread_create_timer_thread): define the stack size for timer thread at compile time. * 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] * 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/branches/ruby_2_1@45119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-21merge revision(s) 44925: [Backport #9492]naruse
* 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/branches/ruby_2_1@45090 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
2013-03-15* thread_pthread.c (numberof): renamed from ARRAY_SIZE() becausekosaki
other all files use numberof(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10* thread_pthread.c (ARRAY_SIZE): new.kosaki
* thread_pthread.c (gvl_acquire_common): use low priority notification for avoiding timer thread interval confusion. If we use timer_thread_pipe[1], every gvl_yield() request one more gvl_yield(). It lead to thread starvation. [Bug #7999] [ruby-core:53095] * thread_pthread.c (rb_reserved_fd_p): adds timer_thread_pipe_low to reserved fds. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10* thread_pthread.c (rb_thread_wakeup_timer_thread_fd): add fdkosaki
argument and remove hardcoded dependency of timer_thread_pipe[1]. * thread_pthread.c (consume_communication_pipe): add fd argument. * thread_pthread.c (close_communication_pipe): ditto. * thread_pthread.c (timer_thread_sleep): adjust the above changes. * thread_pthread.c (setup_communication_pipe_internal): factor out pipe initialize logic. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10* thread_pthread.c (ubf_select): add to small comments why wekosaki
need to call rb_thread_wakeup_timer_thread(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10* thread_pthread.c (rb_thread_create_timer_thread): factor outkosaki
creating communication pipe logic into separate function. * thread_pthread.c (setup_communication_pipe): new helper function. * thread_pthread.c (set_nonblock): moves a definition before setup_communication_pipe. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10* thread_pthread.c (consume_communication_pipe): retry whenkosaki
read returned CCP_READ_BUFF_SIZE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10* thread_pthread.c (timer_thread_sleep): use poll() instead ofkosaki
select(). select doesn't work if timer_thread_pipe[0] is greater than FD_SETSIZE. * thread_pthread.c (USE_SLEEPY_TIMER_THREAD): add a dependency against poll. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10* thread_pthread.c (USE_SLEEPY_TIMER_THREAD): use more accuratekosaki
ifdef condtions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10* thread_pthread.c (set_nonblock): new helper function for set O_NONBLOCK.kosaki
* thread_pthread.c (rb_thread_create_timer_thread): set O_NONBLOCK to timer_thread_pipe[0] too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-23* thread_pthread.c (ruby_init_stack): ignore `STACK_END_ADDRESS'ko1
if Ruby interpreter is running on co-routine. [Feature #2294] https://bugs.ruby-lang.org/issues/2294#note-18 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-15* thread_pthread.c (gvl_init): Reset gvl.wait_yield explicitly whenkosaki
fork()ing. Patch by Apollon Oikonomopoulos. Thanks! [Bug #7693][ruby-core:51424] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-03* configure.in (OBJCOPY): Fixes build error for NativeClient.yugui
Avoid disabling OBJCOPY for NativeClient. * thread_pthread.c (rb_reserved_fd_p): USE_SLEEPY_TIMER_THREAD is always defined. Fixes compilation error for NativeClient. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29adjust stylenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-19* vm.c: support variable VM/Machine stack sizes.ko1
Specified by the following environment variaables: - RUBY_THREAD_VM_STACK_SIZE: vm stack size used at thread creation. default: 128KB (32bit CPU) or 256KB (64bit CPU). - RUBY_THREAD_MACHINE_STACK_SIZE: machine stack size used at thread creation. default: 512KB or 1024KB. - RUBY_FIBER_VM_STACK_SIZE: vm stack size used at fiber creation. default: 64KB or 128KB. - RUBY_FIBER_MACHINE_STACK_SIZE: machine stack size used at fiber creation. default: 256KB or 256KB. This values are specified at launched timing. You can not change these values at running time. Environ variables are only *hints* because: - They are aligned to 4KB. - They have minimum values (depend on OSs). - Machine stack settings are ignored by some OSs. Default values especially fiber stack sizes are increased. This change affect Fiber's behavior: (1) You can run more complex program on a Fiber. (2) You can not make many (thousands) Fibers because of lack of address space (on 32bit CPU). If (2) bothers you, (a) Use 64bit CPU with big memory, or (b) Specify RUBY_FIBER_(VM|MACHINE)_STACK_SIZE correctly. You need to choose correct stack size carefully. These values are completely rely on systems (OS/compiler and so on). * vm_core.h (rb_vm_t::default_params): add to record above settings. * vm.c (RubyVM::DEFAULT_PARAMS): add new constant to see above setting. * thread_pthread.c: support RUBY_THREAD_MACHINE_STACK_SIZE. * cont.c: support RUBY_FIBER_(VM|MACHINE)_STACK_SIZE. * test/ruby/test_fiber.rb: add tests for above. * test/ruby/test_thread.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-05* thread_pthread.c (rb_reserved_fd_p): fix typo in macro checkkosaki
that prevented the ifdef ever being true. [Bug #7281] [ruby-core:48940] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-05* thread_pthread.c (native_thread_init, native_thread_destroy):kosaki
removed HAVE_PTHREAD_CONDATTR_INIT check because this silly #ifdef makes use-uninitialized-var issue and (2) native_cond_initialize() already have a right platform and caller don't need any additional care. [Bug #6825] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-01thread_pthread.c: RUBY_STACK_MINnobu
* thread_pthread.c (RUBY_STACK_MIN): may not a compile time constant. fix r37079. [ruby-dev:46322] [Bug #7247] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e