aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_thread.rb
Commit message (Collapse)AuthorAgeFilesLines
* * eval.c (rb_mod_using): new method Module#using. [experimental]shugo2012-08-021-4/+1
| | | | | | | | * eval.c (rb_mod_refine): new method Module#refine. [experimental] * eval.c (f_using): new method Kernel#using. [experimental] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Synchronize with simple variable assignment.naruse2012-07-231-4/+3
| | | | | | | | | If it uses Queue, Mutex#synchronize may suppress the exception caused by th.raise. The case happens when Ruby switches the thread after it pushes :go into q, in `self.unlock rescue nil`. The exception is rescued the `rescue nil`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Suppress unused variable warnings.naruse2012-07-221-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use assert_normal_exit to avoid stack on buggy implementations.naruse2012-07-221-18/+20
| | | | | | fix for r36492. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_threadptr_execute_interrupts_common): increasenaruse2012-07-221-0/+18
| | | | | | | | | running_time_us on THREAD_TO_KILL like on THREAD_RUNNABLE. This cause not to siwtch from a thread which is to be killed on FreeBSD and Mac OS X. see also the test. This issue maybe exist for long time but happens after r36430. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_s_control_interrupt,ko12012-07-191-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | | rb_thread_s_check_interrupt): added for Thread.control_intgerrupt and Thread.check_interrupt. See details on rdoc. I'll make an ticket for this feature. * test/ruby/test_thread.rb: add a test for Thread.control_intgerrupt. * thread.c (rb_threadptr_raise): make a new exception object even if argc is 0. * thread.c (rb_thread_kill): kill thread immediately if target thread is current thread. * vm_core.h (RUBY_VM_CHECK_INTS_BLOCKING): added. CHECK_INTS while/after blocking operation. * vm_core.h (RUBY_VM_CHECK_INTS): require rb_thread_t ptr. * cont.c (fiber_switch): use replaced RUBY_VM_CHECK_INTS(). * eval.c (ruby_cleanup): ditto. * insns.def: ditto. * process.c (rb_waitpid): ditto. * vm_eval.c (vm_call0): ditto. * vm_insnhelper.c (vm_call_method): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* avoid thread switching.naruse2012-04-221-3/+8
| | | | | | The test may fail if thread switches to d or e before assertions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* It is wrong to expect the last output is "exit".naruse2012-04-101-1/+0
| | | | | | | | When lb.join is commented out as [ruby-dev:30653] says, @keeper is living until the program truely die. So after it outputs "exit.", it may output "#{i}: cont". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/win32.h (rb_w32_aspawn_flags): add the declaration ofshirosaki2012-04-071-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | new function. * process.c (enum): add EXEC_OPTION_PGROUP and move the position above for the usage in proc_spawn_n(). * process.c (proc_spawn_n): add an argument to pass new option `new_pgroup`. The option specifies CREATE_NEW_PROCESS_GROUP flag to CreateProcessW(). This flag is necessary for the usage of Process.kill on the subprocess on Windows. * process.c (rb_exec_arg_addopt): ditto. * process.c (rb_spawn_process): ditto. * process.c (documentation for rb_f_spawn): add documentation for new option `new_pgroup` of spawn. * test/ruby/test_process.rb (TestProcess#test_execopts_new_pgroup): add tests for option `new_pgroup`. * test/ruby/test_thread.rb (TestThreadGroup#test_thread_timer_and_interrupt): add option `new_pgroup: true` to spawn on Windows. It's needed for Process.kill on a subprocess. * win32/win32.c (CreateChild): add an argument to pass dwCreationFlags of CreateProcessW(). * win32/win32.c (rb_w32_spawn): ditto. * win32/win32.c (rb_w32_aspawn_flags): add new function to pass dwCreationFlags. * win32/win32.c (rb_w32_aspawn): refactor to move the content to rb_w32_aspawn_flags(). [ruby-core:43245][Bug #6131] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rbshirosaki2012-04-071-0/+1
| | | | | | | | | | | | (TestThreadGroup#test_thread_timer_and_interrupt): skip on Windows. Process.kill cannot kill a subprocess if CREATE_NEW_PROCESS_GROUP flag is not specified in a call to CreateProcessW(). * win32/win32.c (CreateChild): revert the usage of CREATE_NEW_PROCESS_GROUP flag for compatibility. [ruby-core:43245][Bug #6131] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* misplaced rescuenobu2012-03-311-2/+3
| | | | | | | * test/ruby/test_thread.rb (test_condvar_wait_deadlock_2): fix cleanup code which is never executed because of misplaced rescue. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_thread: test_condvar_wait_not_owner duplicates test_condvar_nolocknobu2012-03-201-8/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_arity.rb (TestArity#err_mess): use assert_raise.nobu2012-03-151-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb ↵nobu2012-01-311-12/+15
| | | | | | (TestThreadGroup#test_thread_timer_and_interrupt): suppress interrupt message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rbshirosaki2012-01-281-3/+8
| | | | | | | | | | | | | | | (TestThreadGroup#test_thread_timer_and_interrupt): skip exit status assertion because we cannot get signal status on Windows. * win32/win32.c (CreateChild): create process group to receive the signal by GenerateConsoleCtrlEvent(). * win32/win32.c (kill): use CTRL_BREAK_EVENT instead of CTRL_C_EVENT if a process group is specified. CTRL_C_EVENT signal cannot be generated for process groups for the specification. [ruby-dev:45149] [Bug #5812] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb: don't test the maximum sleep time. Rubyakr2011-12-221-1/+0
| | | | | | | | is not a real-time system. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use SIGINT to interrupt.naruse2011-12-151-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use pipe instead of $stdin.read.naruse2011-12-141-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread_pthread.c (ubf_select): call rb_thread_wakeup_timer_thread()naruse2011-12-141-0/+15
| | | | | | | 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
* increase difference of priority to avoid false nagative test result.naruse2011-11-241-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb (test_condvar_timed_wait): useakr2011-11-151-1/+2
| | | | | | | | assert_operator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert test fixes.naruse2011-09-101-5/+2
| | | | | | This reverts r33233, r33234, and r33235. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Decide by majority.naruse2011-09-091-2/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb (TestThread#test_no_valid_cfp): skip whenusa2011-09-011-0/+1
| | | | | | | | | win32ole is required. in such case, win32ole redefines Thread#initialize, and the block argument becomes to be not the top of the thread, then this testcase always fails. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c: check if cfp is valid. [Bug #5083] [ruby-dev:44208]ktsj2011-07-311-0/+12
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb (TestThread#test_priority): enablekosaki2011-06-211-1/+1
| | | | | | | | | this test again. Current GVL respect thread priority rather than past. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb (TestThread#test_kill_thread_subclass):nagachika2011-06-091-0/+11
| | | | | | add test for Thread.kill with Thread subclass instance. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb (TestThread#test_kill_wrong_argument):nagachika2011-06-091-0/+7
| | | | | | | test for [ruby-core:35086]. partially forward porting r31402 from ruby_1_9_2 branch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (ruby_cleanup): use rb_ary_free to free internal object.nobu2011-02-111-1/+10
| | | | | | | * gc.h (RUBY_FREE_UNLESS_NULL): get rid of double free. [ruby-core:35192] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb: remove unused variables.kazu2011-01-241-3/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb (TestThread#test_condvar_nolock_2): get rid of ↵kazu2011-01-241-1/+1
| | | | | | method redefined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb: Added various ConditionVariable tests.kosaki2011-01-241-0/+114
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Reduced gem_prelude to just require rubygems. Reviewed by Evan Phoenixryan2011-01-141-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Clean warnings: unused variables.naruse2010-06-231-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use only object_id to test living threads.naruse2010-02-191-2/+2
| | | | | | | | | | | Previous test depends on timing like: <"[#<Thread:0x000008013413a0 run>, #<Thread:0x00000801341418 run>, #<Thread:0x00000801364940 run>]"> expected but was <"[#<Thread:0x000008013413a0 run>, #<Thread:0x00000801341418 sleep>, #<Thread:0x00000801364940 run>]">. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb (test_priority): removed not-guaranteed result.nobu2009-12-231-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Decrease counts of tests which spend so long time.naruse2009-11-041-2/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb (test_status_and_stop_p): reduce the risknobu2009-10-161-4/+2
| | | | | | | of race condition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb (TestThread#test_recursive): removematz2009-09-161-9/+0
| | | | | | implementation dependent test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_exec_recursive_outer, rb_exec_recursive): Added method to ↵marcandre2009-09-151-0/+13
| | | | | | | | | | | | | | | | | | short-circuit to the outermost level in case of recursion * test/ruby/test_thread.rb (test_recursive_outer): Test for above * hash.c (rb_hash_hash): Return a sensible hash for in case of recursion [ruby-core:24648] * range.c (rb_range_hash): ditto * struct.c (rb_struct_hash): ditto * array.c (rb_array_hash): ditto * test/ruby/test_array.rb (test_hash2): test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c, vm_eval.c: add Thread.backtrace.ko12009-06-141-0/+10
| | | | | | | | * test/ruby/test_thread.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_mutex_trylock): return false if Mutex ownedko12008-12-291-0/+12
| | | | | | | | | | by current thread. [ruby-core:20943] * thread.c (rb_mutex_lock): check dead lock (recursive lock) here. * test/ruby/test_thread.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test: assert_raises has been deprecated since a long time ago.nobu2008-09-241-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb: fix test.ko12008-09-031-1/+1
| | | | | | | | [ruby-dev:35960] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb (test_status_and_stop_p): reduce the riskmame2008-08-251-6/+9
| | | | | | | of race condition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb (test_list): call Thread.pass to run t1.shugo2008-08-131-0/+1
| | | | | | | fixed [ruby-core:18264]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c, vm_core.h: add manual priority supportko12008-08-131-1/+1
| | | | | | | | | | | using time slice. if you enable USE_NATIVE_THREAD_PRIORITY macro, this mechanism is ignored. [ruby-dev:33124] * thread_pthread.c, thread_win32.c: ditto. * test/ruby/test_thread.rb: fix test parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/envutil.rb (Test::Unit::Assertions#assert_in_out_err): newmame2008-07-151-96/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | method. * test/ruby/test_argf.rb: use assert_in_out_err instead of EnvUtil.rubyexec. * test/ruby/test_module.rb: ditto. * test/ruby/test_require.rb: ditto. * test/ruby/test_objectspace.rb: ditto. * test/ruby/test_object.rb: ditto. * test/ruby/test_string.rb: ditto. * test/ruby/test_method.rb: ditto. * test/ruby/test_variable.rb: ditto. * test/ruby/test_io.rb: ditto. * test/ruby/test_rubyoptions.rb: ditto. * test/ruby/test_exception.rb: ditto. * test/ruby/test_class.rb: ditto. * test/ruby/test_thread.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_thread.rb: add a test.mame2008-06-121-0/+22
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_file.rb: add tests for uninitialized object.mame2008-06-021-0/+6
| | | | | | | | | * test/ruby/test_class.rb: ditto. * test/ruby/test_thread.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e