summaryrefslogtreecommitdiff
path: root/thread.c
AgeCommit message (Collapse)Author
2013-10-09merge revision(s) 43208: [Backport #9003]nagachika
* compar.c (cmp_eq): fail if recursion. [ruby-core:57736] [Bug #9003] * thread.c (rb_exec_recursive_paired_outer): new function which is combinnation of paired and outer variants. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@43230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-12merge revision(s) 42906: [Backport #8891]nagachika
* thread.c (rb_mutex_unlock): Mutex#unlock no longer raise an exception even if uses on trap. [Bug #8891] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@42926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-07merge revision(s) 40208: [Backport #8380]nagachika
* internal.h (MUL_OVERFLOW_SIGNED_INTEGER_P): New macro. (MUL_OVERFLOW_FIXNUM_P): Ditto. (MUL_OVERFLOW_LONG_P): Ditto. * array.c (rb_ary_product): Don't overflow on signed integer multiplication. * numeric.c (fix_mul): Ditto. (int_pow): Ditto. * rational.c (f_imul): Ditto. * insns.def (opt_mult): Ditto. * thread.c (sleep_timeval): Don't overflow on signed integer addition. * bignum.c (rb_int2big): Don't overflow on signed integer negation. (rb_big2ulong): Ditto. (rb_big2long): Ditto. (rb_big2ull): Ditto. (rb_big2ll): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@40602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-02merge revision(s) 39939: [Backport #8360]nagachika
* thread.c (double2timeval): convert the infinity to TIME_MAX to avoid SEGV by Thread.new {}.join(Float::INFINITY) on Debian GNU/Linux (amd64). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@40562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-19merge revision(s) 40000: [Backport #8097]nagachika
* thread.c (rb_mutex_synchronize_m): yield no block params. patch by splattael (Peter Suschlik) in [ruby-core:53773] [Bug #8097]. fix GH-266. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@40380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-20merge revision(s) 39775: [Backport #8080]nagachika
* thread.c: disabled _FORTIFY_SOURCE for avoid to hit glibc bug. [Bug #8080] [ruby-core:53349] * test/ruby/test_io.rb (TestIO#test_io_select_with_many_files): test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10merge revision(s) 39484,39485: [Backport #7952]nagachika
* thread.c: Document Thread::new, clean up ::fork and mention calling super if subclassing Thread git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-09merge revision(s) 39461:nagachika
* thread.c: Document ThreadGroup::Default git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-24backport r39460, ack'd by mame-sanzzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-24* thread.c: Documentation for Thread#backtrace_locationszzak
[Backport #7932] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-24* thread.c: Improved rdoc for ::handle_interrupt, ::pending_interrupt?zzak
and #pending_interrupt? [Backport #7934] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-10Thu Jan 10 19:39:05 2013 TAKANO `takano32' Mitsuhiro <tak@no32.tk>takano32
* thread.c: fix RB_GC_SAVE_MACHINE_REGISTER_STACK define for ia64. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-25* ChangeLog: revert a part of r38595. 'iff' means 'if and only if', not typo.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-25* bignum.c, include/ruby/intern.h (rb_big_eql): exported.usa
* thread.c (recursive_check): object_id maybe a Bignum, not Fixnum on LLP64. see also r38493 and r38548. reported by Heesob Park at [ruby-core:51083] [Bug #7607], and patched by shirosaki at [ruby-core:51095] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-25add empty line for style.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-23* thread.c: rename methods:ko1
from Thread.async_interrupt_timing to Thread.handle_interrupt, from Thread.async_interrupted? to Thread.pending_interrupt?. Also rename option from `defer' to `never'. [ruby-core:51074] [ruby-trunk - Feature #6762] * vm_core.c, thread.c: rename functions and data structure `async_errinfo' to `pending_interrupt'. * thread.c: add global variables sym_immediate, sym_on_blocking and sym_never. * cont.c, process.c, vm.c, signal.c: ditto. * lib/sync.rb, lib/thread.rb: catch up this renaming. * test/ruby/test_thread.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-23thread.c: ignore result of blocking_region_beginnobu
* thread.c (BLOCKING_REGION): if fail_if_interrupted is false ignore the result of blocking_region_begin(), since it always is true in that case. suppress "uninitialized" warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22* cont.c (rb_fiber_start): in case of jump with TAG_FATAL,nagachika
enqueue error into async_errinfo_queue, because you cannot call TH_TAG_JUMP() in this function. [ruby-dev:45218] [Bug #5993] * thread.c (rb_threadptr_execute_interrupts): now INT2FIX(TAG_FATAL) can be popped from async_errinfo_queue. * vm.c (rb_vm_make_jump_tag_but_local_jump): revert r38441. rb_vm_make_jump_tag_but_local_jump() shouldn't return exception in case of state == TAG_FATAL. * test/ruby/test_fiber.rb (test_exit_in_fiber): fix a test to illuminate Thread.exit should terminate current Thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-19style fix.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-18* thread.c (rb_thread_wait_fd_rw): fix infinite loop bug.kosaki
rb_wait_for_single_fd() never return positive number. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-15* parse.y (yycompile0): adjust indent.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-15* thread.c (rb_mutex_owned_p): remove static.kosaki
* io.c (io_flush_buffer): don't hold mutex if already have. Now recursive lock may occur when following scenario. fptr_finalize -> finish_writeconv_sync -> finish_writeconv -> io_fflush. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-15* thread.c (rb_thread_wait_fd_rw): remove silly rb_thread_alone()kosaki
check. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-15thread.c: revert r38382 but deprecate rb_thread_polling()nobu
* thread.c (rb_thread_polling): revert but deprecate. * include/ruby/intern.h (rb_thread_polling): deprecate. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-14* file.c (rb_file_flock): use rb_thread_wait_for() instead ofkosaki
rb_thread_polling(). When getting EAGAIN, we need to wait a while even if no multi threading. * thread.c (sleep_for_polling, rb_thread_polling) removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-05* thread.c (rb_uninterruptible): helper function for providingkosaki
temporary async_interrupt_timing(Object => :defer) * io.c (rb_f_p): use rb_uninterruptible. * io.c (rb_f_p_internal): helper function for rb_f_p(). * io.c (struct rb_f_p_arg): new struct for rb_f_p_internal. * test/ruby/test_thread.rb (test_async_interrupt_and_p): test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-05 * thread.c (rb_thread_s_async_interrupt_timing): have to check ints before ↵tarui
jumpping out. * test/ruby/test_thread.rb (test_async_interrupt_with_return): add test rescue has to catch a queued async exception at the time of return. * test/ruby/test_thread.rb (test_async_interrupt_with_break): add test rescue has to catch a queued async exception at the time of break. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-04 * vm_core.h (RUBY_VM_CHECK_INTS_BLOCKING): check async queue everytime.tarui
* thread.c (sleep_forever): check RUBY_VM_CHECK_INTS_BLOCKING first. * thread.c (sleep_timeval): ditto. * test/ruby/test_thread.rb (test_async_interrupt_blocking): add a test exceptions are correctly defared and raised on :on_blocking context. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-04supress warningkosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-04supress warningkosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-04* thread.c (rb_mutex_owned_p): new method that return currentkosaki
thread have the target mutex or not. [Feature #7505] [ruby-dev:46697] * test/ruby/test_thread.rb (test_mutex_owned, test_mutex_owned2): test for the above. * NEWS: new for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-02 * thread.c (RB_GC_SAVE_MACHINE_CONTEXT, rb_gc_save_machine_context): tarui
extract rb_gc_save_machine_context to RB_GC_SAVE_MACHINE_CONTEXT. NOTE: machine_regs and machine_stack_end must be set in current scope. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-02revert r38141 for stack problemtarui
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-02 * thread.c (RB_GC_SAVE_MACHINE_CONTEXT, rb_gc_save_machine_context):tarui
Don't set machine_regs and machine_stack_end with a different scope. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30* thread.c (Thread.async_interrupt_timing): fix RDoc.ko1
:never is not used any more. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30* thread.c (rb_threadptr_interrupt_mask, async_interrupt_timing_func):kosaki
merge into them into rb_thread_s_async_interrupt_timing. * thread.c (rb_thread_s_async_interrupt_timing): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30* thread.c (rb_threadptr_interrupt_mask): add argument check.kosaki
* thread.c (async_interrupt_timing_arg_check_i): helper function for the above. * test/ruby/test_thread.rb (test_async_interrupt_timing_invalid_argument): test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30* vm_core.h (rb_vm_struct): add thread_destruct_lock field.kosaki
* thread.c (Init_Thread): ditto. * thread.c (rb_vm_gvl_destroy): ditto. * thread.c (thread_start_func_2): make sure vm->running_thread don't point to dead thread. * thread.c (timer_thread_function): close a race against thead destruction. [Bug #4911][ruby-dev:43859] * vm_core.h (rb_thread_set_current): reset running time of current thread instead of previous thread. We no longer assume previous running thread still live. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30revert r35486 (add rb_thread_t#yeiling field). because it doesn't helpkosaki
to close a race. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30* thread.c: TracePoint#self returns invoking/exitting thread objectko1
at thread_begin/end event. * test/ruby/test_settracefunc.rb: fix test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30* thread.c: rename Thread.control_interruptko1
to Thread.async_interrupt_timing. The option name `:never' is also changed to `:defer'. [ruby-core:50375] [ruby-trunk - Feature #6762] * thread.c: remove Thread.check_interrupt. This method is difficult to understand by name. * thraed.c: add Thread.async_interrupted?. This method check any defered async interrupts. * test/ruby/test_thread.rb: change tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29* thread.c (rb_thread_interrupted): avoid warning ofko1
implicit conversion. * thread.c (rb_threadptr_execute_interrupts): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 [EXPERIMENTAL: NEED DISCUSS]ko1
* vm_trace.c: add events * :thread_begin - hook at thread beggining. * :thead_end - hook at thread ending. * :b_call - hook at block enter. * :b_return - hook at block leave. This change slow down block invocation. Please try and give us feedback until 2.0 code freeze. * include/ruby/ruby.h: ditto. * compile.c (rb_iseq_compile_node): ditto. * insns.def: ditto. * thread.c: ditto. * vm.c: ditto. * include/ruby/debug.h: add a comment. * test/ruby/test_settracefunc.rb: add a tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29Revert r37956: thread.c (thread_start_func_2): small cleanups.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29* thread.c (thread_start_func_2): remove unused code. Whenkosaki
th->safe_level == 4, th->errinfo never be thrown. So, to create new exception makes no sense. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29Revert r37953: thread.c (thread_start_func_2): remove unused code. securitynaruse
This sticks at bootstraptest/test_fork.rb:24 on FreeBSD and darwin. http://fb.rubyci.org/~chkbuild/ruby-trunk/log/20121128T230302Z.log.html.gz http://a.mrkn.jp/~mrkn/chkbuild/sl/ruby-trunk-m64-gcc42-o0/log/20121128T235908Z.log.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29* thread.c (do_select): suppress warning (uninitialized value warning)naruse
with UNINITIALIZED_VAR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28* thread.c (thread_start_func_2): small cleanups.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28* thread.c (thread_start_func_2): remove unused code.kosaki
this function never be used for main thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28* thread.c (thread_start_func_2): remove unused code.kosaki
errinfo = th->errinfo; and errinfo = rb_errinfo(); are the same. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e