aboutsummaryrefslogtreecommitdiffstats
path: root/thread_pthread.c
Commit message (Collapse)AuthorAgeFilesLines
* * thread_pthread.c (ruby_init_stack): ignore `STACK_END_ADDRESS'ko12013-01-231-0/+21
| | | | | | | | | | 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
* * thread_pthread.c (gvl_init): Reset gvl.wait_yield explicitly whenkosaki2013-01-151-0/+1
| | | | | | | 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
* * configure.in (OBJCOPY): Fixes build error for NativeClient.yugui2013-01-031-1/+1
| | | | | | | | | 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
* adjust stylenobu2012-12-291-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c: support variable VM/Machine stack sizes.ko12012-12-191-22/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * thread_pthread.c (rb_reserved_fd_p): fix typo in macro checkkosaki2012-11-051-1/+1
| | | | | | | | | 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
* * thread_pthread.c (native_thread_init, native_thread_destroy):kosaki2012-11-051-4/+0
| | | | | | | | | | | 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_MINnobu2012-11-011-8/+8
| | | | | | | | * 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: precise stack sizenobu2012-10-041-2/+10
| | | | | | | | * thread_pthread.c (ruby_init_stack): round stack limit to page size boundary to calculate stack size more precisely. [ruby-dev:46174] [Bug #7084] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (RUBY_STACK_MIN_LIMIT): name magic number.nobu2012-10-041-19/+21
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread_pthread.c: init stack with ulimitnobu2012-10-031-1/+11
| | | | | | | | | * 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
* * thread_pthread.c (native_cond_initialize): destroy condattrkosaki2012-09-201-0/+1
| | | | | | | 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
* * thread_pthread.c (native_cond_initialize): clean up #ifdef condition.kosaki2012-09-201-4/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* adjust stylenobu2012-09-041-1/+2
| | | | | | * thread_pthread.c, vm_eval.c: adjust style. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread_pthread.c: STACK_GROW_DIR_DETECTIONnobu2012-07-211-0/+1
| | | | | | | | * thread_pthread.c (ruby_init_stack): STACK_GROW_DIR_DETECTION is necessary on platforms with unknown stack direction. [Bug #6761] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c: use #ifdef, not #if.naruse2012-07-191-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (register_cached_thread_and_wait):ko12012-06-261-2/+8
| | | | | | | | | | return immediately if malloc() failed. [ruby-core:43960] [ruby-trunk - Bug #6235] * thread_pthread.c (USE_THREAD_CACHE): check already defined or not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c: Add doxygen comments.yugui2012-06-141-0/+4
| | | | | | | | | | | | * ruby.c: ditto. * thread_pthread.c: ditto * version.c: ditto. * vm_core.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (get_stack): Linux is the only OS which includesnaruse2012-06-131-15/+12
| | | | | | the size of guard page into the stack size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread_pthread.c: suppress warningnobu2012-06-131-0/+2
| | | | | | * thread_pthread.c (get_stack): define guard only when it is used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (rb_thread_create_timer_thread): assign returnnaruse2012-06-101-1/+2
| | | | | | value to the variable err. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (native_cond_initialize): fix typo in r36022.naruse2012-06-101-1/+1
| | | | | | | this cause a failure on FreeBSD 8.2 amd64. http://fbsd.rubyci.org/~chkbuild/ruby-trunk/log/20120610T130201Z.diff.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fixes threading on NativeClient.yugui2012-06-101-65/+132
| | | | | | | | | | | | * thread_pthread.c (timer_thread_sleep): Extracted out a function from thread_timer(). Added an alternative implementation for platforms that lacks select(2) or pipe(2). (rb_thread_create_timer_thread, native_cond_initialize, native_cond_destroy): Replaced wrong HAVE_XXX checks. * configure.in (pthread_attr_init): New check. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.h: IS_STACK_DIR_UPPERnobu2012-06-101-1/+1
| | | | | | | * gc.h (IS_STACK_DIR_UPPER): utility macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread_pthread.c: adjust stack sizenobu2012-06-101-8/+6
| | | | | | | | * thread_pthread.c (get_stack): seems stack size does not include guard size on Mac OS X. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread_pthread.c: adjust stack sizenobu2012-06-101-2/+3
| | | | | | | | * thread_pthread.c (ruby_init_stack): adjust stack size for offset of addr from the bottom. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread_pthread.c: use stack infonobu2012-06-081-2/+2
| | | | | | | * thread_pthread.c (ruby_init_stack): use stack info if possible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (rb_thread_create_timer_thread): Added errorkosaki2012-05-181-4/+8
| | | | | | check when failing fcntl(). [Bug #6147] [ruby-dev:45364] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix NaCl supportnobu2012-05-171-2/+2
| | | | | | | | | * configure.in: fix function name to be checked, to initialize rb_thread_cond_t properly. * thread_pthread.c (native_cond_initialize, native_cond_destroy): fix macro name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c, thread_pthread.c: Moved pthread-specific preprocessoryugui2012-05-171-1/+5
| | | | | | | hacks to thread_pthread.c git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Imports Ruby's port to NativeClient (a.k.a NaCl).yugui2012-05-171-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch by Google Inc. [ruby-core:45073]. * configure.in (RUBY_NACL): New M4 func to configure variables for NaCl. (RUBY_NACL_CHECK_PEPPER_TYPES): New M4 func to check the old names of Pepper interface types. (BTESTRUBY): New variable to specify which ruby should be run on "make btest". NaCl can run the built binary by sel_ldr, but it need rbconfig.rb. So this variable is distinguished from $MINIRUBY. * thread_pthread.c: Disabled some features on NaCl. * io.c: ditto. * process.c: ditto. * signal.c: ditto. * file.c: ditto. * missing/flock.c: ditto. * nacl/pepper_main.c: An example implementation of Pepper application that embeds Ruby. * nacl/example.html: An example of web page that uses the Pepper application. * nacl/nacl-config.rb: Detects variants of NaCl SDK. * nacl/GNUmakefile.in: Makefile template for NaCl specific build process. * nacl/package.rb: script for packaging a NaCl-Ruby embedding application. * nacl/reate_nmf.rb: Wrapper script of create_nmf.py * dln.c (dln_load): Added a hack to call on NaCl. * util.c (ruby_getcwd): Path to the current directort is not available on NaCl. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c: add prototype declarations for older Mac OS X.nobu2012-04-101-0/+2
| | | | | | | [ruby-core:43376][Bug #6170] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * adjust style.nobu2012-03-151-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (native_cond_timeout): cast explicitly to suppressnobu2012-03-021-1/+1
| | | | | | | a warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (ping_signal_thread_list): remove return value.nagachika2011-12-221-6/+13
| | | | | | | | | | * thread_pthread.c (check_signal_thread_list): add a new function to check if signal thread list is empty. * thread_pthread.c (thread_timer): check signal thread list after timer_thread_function(). main thread might be added into signal thread list during timer_thread_function(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (ubf_select): call rb_thread_wakeup_timer_thread()naruse2011-12-141-2/+3
| | | | | | | only when it is not timer_thread. [Bug #5757] [ruby-dev:44985] patched by Tomoyuki Chikanaga. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (rb_thread_create_timer_thread): fix memoryokkez2011-12-131-0/+1
| | | | | | | | leak. [ruby-dev:44904] [Bug #5688] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (thread_timer): call prctl(PR_SET_NAME) only ifnagachika2011-12-011-1/+1
| | | | | | PR_SET_NAME is available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * configure.in: add sys/prctl.h test.kosaki2011-11-301-0/+7
| | | | | | | * thread_pthread.c (thread_timer): call prctl(PR_SET_NAME) to change thread name. It may help to debug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (add_signal_thread_list): suppress warning fornobu2011-11-271-2/+2
| | | | | | unused function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (gvl_yield): don't prevent concurrent sched_yield().kosaki2011-11-091-9/+5
| | | | | | | | [Bug #5130] [ruby-core:38647] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * whitespace cleanup.nobu2011-11-041-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h (rb_cloexec_pipe): declared.akr2011-10-301-9/+3
| | | | | | | | | | | | * io.c (rb_cloexec_pipe): new function. (rb_pipe): use rb_cloexec_pipe. * thread_pthread.c (rb_thread_create_timer_thread): use rb_cloexec_pipe. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h (rb_fd_set_cloexec): declared.akr2011-10-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * io.c (rb_fd_set_cloexec): new function. (ruby_dup): call rb_fd_set_cloexec to set close-on-exec flag. (rb_sysopen_internal): ditto. (rb_pipe): ditto. (io_reopen): ditto. (io_cntl): ditto. * process.c (rb_f_exec): change the default :close_others option to true. (rb_f_system): ditto. (move_fds_to_avoid_crash): call rb_fd_set_cloexec to set close-on-exec flag. (ruby_setsid): ditto. (rb_daemon): ditto. * thread_pthread.c (rb_thread_create_timer_thread): call rb_fd_set_cloexec to set close-on-exec flag. * ruby.c (load_file_internal): ditto. * file.c (rb_file_s_truncate): ditto. (file_load_ok): ditto. * random.c (fill_random_seed): ditto. * ext/pty/pty.c (chfunc): ditto. (get_device_once): ditto. * ext/openssl/ossl_bio.c (ossl_obj2bio): ditto. * ext/socket/init.c (rsock_socket): ditto. (rsock_s_accept_nonblock): ditto. (rsock_s_accept): ditto. * ext/socket/socket.c (rsock_sock_s_socketpair): ditto. * ext/socket/ancdata.c (discard_cmsg): ditto. (make_io_for_unix_rights): ditto. * ext/socket/unixsocket.c (unix_recv_io): ditto. * ext/io/console/console.c (console_dev): ditto. [ruby-core:38140] [Feature #5041] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c: make native_fd_select().kosaki2011-09-271-0/+6
| | | | | | | | | * thread.c (do_select): remove #ifdef _WIN32. Instead, use native_fd_select() always. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (ubf_select): activate timer thread when interruptnagachika2011-09-211-0/+1
| | | | | | | | | | blocking thread. A patch created by Koichi Sasada. [ruby-core:39634] [Bug #5343] to cover race condition, timer thread periodically send SIGVTARLM to threads in signal thread list. so you should activate timer thread when interrupt a thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c: fix typo.mrkn2011-08-051-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (native_cond_signal): retry to call pthread_cond_signalmrkn2011-08-041-7/+23
| | | | | | | | | | | | | | and pthread_cond_broadcast if they return EAGAIN in native_cond_signal and native_cond_broadcast, respectively. It is for the pthread implementation of Mac OS X 10.7 (Lion). fixes #5155. [ruby-dev:44342]. * thread_pthread.c (native_cond_broadcast): ditto. * thread_pthread.c (struct cached_thread_entry): stop using pthread_cond_t and its functions directly. * thread_pthread.c (register_cached_thread_and_wait): ditto. * thread_pthread.c (use_cached_thread): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_update_max_fd): new function.akr2011-07-191-0/+2
| | | | | | | | | | | * internal.h (rb_update_max_fd): declare rb_update_max_fd. * thread_pthread.c (rb_thread_create_timer_thread): update max fd when timer thread pipe is created. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (get_stack): need to adjust stack addr forkanemoto2011-07-101-0/+1
| | | | | | | | [Bug #1813] on AIX. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e