in RBASIC()->flags. [ruby-dev:45002] [Bug #5768]
* thread.c (rb_barrier_wait): increment and decrement around
rb_mutex_lock, and use rb_barrier_waiting().
* thread.c (rb_barrier_release): use rb_barrier_waiting().
* thread.c (rb_barrier_destroy): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
from loading_table if it is not in-use. [Bug #5754]
* thread.c (rb_barrier_release, rb_barrier_destroy): return
whether any other threads are waiting on it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
destroyed.
* thread.c (rb_barrier_wait): return nil for recursive lock
instead of false, to distinguish it from destroyed barrier.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
share same loading barrier, so it must be kept alive while those
are waiting on it. [ruby-core:41618] [Bug #5754]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
violation and too large hack.
* thread.c (cmp_tv, subtract_tv): removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
modification of rb_thread_fd_select().
based on a patch by Eric Wong. [Bug #5306] [ruby-core:39435]
* thread.c (rb_fd_rcopy): New. for reverse fd copy.
* test/-ext-/old_thread_select/test_old_thread_select.rb
(test_old_select_false_positive): test for bug5306.
* ext/-test-/old_thread_select/old_thread_select.c (fdset2array):
New. convert fdsets to array.
* ext/-test-/old_thread_select/old_thread_select.c (old_thread_select):
return 'read', 'write', 'except' argument of rb_thread_select()
to ruby script.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
for rb_thread_select() in thread.c. the use of rb_fd_copy() is
introduced in r33117.
[Bug #5229] [ruby-core:39102]
* thread.c (rb_thread_select): must call rb_fd_init() before using
rb_fdset_t. see the implementations of rb_fd_init()s if you want to
know the reason.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_thread_fd_select(). old one is EINTR unsafe.
Patch by Eric Wong. [Bug #5229] [ruby-core:39102]
* test/-ext-/old_thread_select/test_old_thread_select.rb:
a testcase for rb_thread_select().
* ext/-test-/old_thread_select/old_thread_select.c: ditto.
* ext/-test-/old_thread_select/depend: ditto.
* ext/-test-/old_thread_select/extconf.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
line is out of the way. rb_sourceline() is unreliable when source
code is big. [ruby-dev:44413]
* test/coverage/test_coverage.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
state when set_trace_func hook is removed. This is workaround patch
to force to reset tracing state that is broken by continuation call.
a patch from James M. Lawrence. [Feature #4347] [ruby-core:34998]
* test/ruby/test_continuation.rb (class TestContinuation): add a test
for above. a patch from James M. Lawrence.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
'inhibit_thread_createion' field.
* thread.c (rb_thread_terminate_all): set inhibit_thread_creation.
* thread.c (thread_s_new): don't permit to create new thread
if the VM is under destruction. Otherwise evil finalizer code
can make SEGV. [Bug #4992][ruby-core:37858]
* bootstraptest/test_objectspace.rb: new test for this fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c (rb_threadptr_execute_interrupts_common): check signal
deliverly if it is main thread.
fixes [ruby-dev:44005] [Ruby 1.9 - Bug #4950]
* bootstraptest/test_fork.rb: add a test for above.
* signal.c (rb_get_next_signal): skip if signal_buff is empty.
(check signal_buff.size first)
* vm_core.h: remove unused variable rb_thread_t::exec_signal.
* thread.c (rb_thread_check_trap_pending): check
rb_signal_buff_size() because rb_thread_t::exec_signal
is no longer available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
for methods defined by define_method().
* thread.c (call_trace_proc): Fix to skip if class is not given (0).
Note that ID and Class object are passed for call/return event
if the called method was defined by define_method().
If you are author of tracer/profiler/debugger, this may be an
important change. You should check passed class as zero or
non-zero instead of checking the event type.
* test/ruby/test_settracefunc.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
eliminate machine context saving when running time is enough small.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_thread_schedule().
And also rename to rb_thead_schedule_limits() and remove
sched_depth argument. It's no longer called recursive.
* thread.c (rb_thread_schedule): add to check interrupt_flag as
above explained.
* thread.c (rb_threadptr_execute_interrupts_rec): rename to
rb_threadptr_execute_interrupts_common() and remove sched_depth
argument. It's no longer called recursive.
* thread.c (rb_thread_sleep): adapt the renaming.
* thread.c (rb_threadptr_execute_interrupts): ditto.
* thread.c (rb_thread_execute_interrupts): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
a sample code. The actual implementaion never behave as explained by
an example. It's a documentation bug.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
example is buggy and may cause deadlock. The patch is
suggested by Heesob Park <phasis@gmail.com>. Thank you!
[Bug #3606][ruby-core:31454]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
example is buggy and may not display anything by a race.
The patch is suggested by Heesob Parrk <phasis@gmail.com>.
Thank you! [Bug #3606][ruby-core:31454]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
and may cause deadlock. The patch is suggested by Heesob Park
<phasis@gmail.com>. Thank you! [Bug #3606][ruby-core:31454]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
no waiting thread. If there are 2 or more runnable threads,
the timer thread does polling. Avoid polling makes power save
for several computers (0.2W per a Ruby process, when I measured).
If outside-event such as signal or Thread#kill was occuerred
when the timer thread does not do polling, then wake-up
the timer thread using communication-pipe (the timer thread
waits this communication-pipe with select(2)).
The discussion about this modification can be found from the post
[ruby-core:33456] and other related posts.
Note that Eric Wong and KOSAKI Motohiro give us the huge
contributions for this modification. Thanks.
* thread_pthread.c (rb_thread_wakeup_timer_thread): add a function.
This function wakes up the timer thread using communication-pipe.
* thread.c (rb_thread_stop_timer_thread): add a parameter which
specify closing communication-pipe or not.
* thread.c (rb_thread_terminate_all): do not stop timer thread here
(ruby_cleanup() terminate timer thread).
* signal.c: wake up timer thread using
rb_thread_wakeup_timer_thread() from signal handler.
* eval.c (ruby_cleanup): use rb_thread_stop_timer_thread(1).
* process.c: use rb_thread_stop_timer_thread(0)
(reuse communication-pipe).
* thread_win32.c (rb_thread_wakeup_timer_thread): add a dummy
function.
* vm_core.h: add and fix decl. of functions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
backup. fix race condition which may results unexpected main thread's
status transition. see #4072
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c, eval.c, iseq.c, object.c, parse.y, proc.c, process.c,
thread.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c: don't
declare internal functions.
Note that rb_method_entry_eq() is defined in vm_method.c but
there was a declaration in proc.c with different const-ness.
Now it is declared in method.h with same const-ness to the
definition.
* object.c (rb_mod_module_exec): don't declare functions declared in
include/ruby/intern.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
cancelable.
* thread_win32.c (native_fd_select): new function to make select(2)
cancelable.
* thread_win32.c (rb_w32_check_interrupt): new function for checking
interrupt.
* win32/win32.c (rb_w32_select_with_thread): new function. cancelable
select(2).
* win32/win32.c (rb_w32_select): use above function internally.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e