* 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
* 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
* 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
* 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
* 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
* 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
* 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
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
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
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
.. #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
* 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
* 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
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
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
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
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
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
* 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
* thread_pthread.c (ruby_init_stack): use getrlimit() for the main
thread on Mac OS X, since pthread_get_stack{addr,size}_np() and
return the default value always, but not the ulimit value.
[ruby-dev:46174] [Bug #7084]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
after using it. Patch by Stanislav Sedov. Thank you.
[Bug #7041] [ruby-core:47619]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e