1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
Commit graph

16 commits

Author SHA1 Message Date
kosaki
1c47bd88c1 * lib/thread.rb (Queue#push): return self.
* lib/thread.rb (Queue#clear): ditto.
* lib/thread.rb (SizedQueue#push): ditto.
* test/thread/test_queue.rb: add tests for the above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10 23:01:21 +00:00
kosaki
19e0d7c18e * test/thread/test_queue.rb (TestQueue#test_thr_kill): reduce
iterations from 2000 to 250. When running on uniprocessor
  systems, every th.kill needs TIME_QUANTUM_USEC time (i.e.
  100msec on posix systems). Because, "r.read 1" is 3 steps
  operations that 1) release GVL 2) read 3) acquire gvl and
  (1) invoke context switch to main thread. and then, main
  thread's th.kill resume (1), but not (2). Thus read interrupt
  need TIME_QUANTUM_USEC. Then maximum iteration is 30sec/100msec
  = 300.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10 04:00:44 +00:00
kosaki
1f1db611b9 * lib/thread.rb (ConditionVariable): use hash instead of array for
@waiters.
* test/thread/test_queue.rb (test_sized_queue_and_wakeup): remove
  a test because @waiters no longer have a chance to duplicated. Now it's
  a hash.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 08:28:44 +00:00
kosaki
3357d88ada * lib/thread.rb (SizedQueue#pop): rewrite by using ConditionVariable.
* lib/thread.rb (SizedQueue#push): ditto.
* lib/thread.rb (SizedQueue#max): ditto.
* lib/thread.rb (Queue#pop): ditto.
* lib/thread.rb (Queue#push): ditto.

* lib/thread.rb (SizedQueue#num_waiting): adopt the above changes.
* lib/thread.rb (SizedQueue#initialize): ditto.
* lib/thread.rb (Queue#num_waiting): ditto.
* lib/thread.rb (Queue#initialize): ditto.
* test/thread/test_queue.rb (test_sized_queue_and_wakeup): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30 18:55:09 +00:00
shirosaki
4d4800a5a7 envutil.rb: kill child process when timeout
* test/ruby/envutil.rb (EnvUtil#invoke_ruby): kill child process
  before Timeout::Error is raised. rmdir of mktmpdir fails with
  EACCES if child process is alive on Windows.

* test/thread/test_queue.rb (TestQueue): increase timeout.
  This test takes long time on Windows XP.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-29 11:19:11 +00:00
kosaki
7198053a49 * lib/thread.rb (Queue#pop): Fixed double registration issue when
mutex.sleep is interrupted. [Bug #5258] [ruby-dev:44448]
* lib/thread.rb (SizedQueue#push): ditto.

* test/thread/test_queue.rb (test_sized_queue_and_wakeup,
test_queue_pop_interrupt, test_sized_queue_pop_interrupt,
test_sized_queue_push_interrupt): new tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-09 12:32:33 +00:00
akr
dc42e8bbe8 refine message for test_thr_kill.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-23 07:55:39 +00:00
akr
e89bebdab4 * test/thread/test_queue.rb (test_thr_kill): show the number of loop
run when the test failed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-23 01:15:35 +00:00
naruse
92c5d84a40 Decrease timeout limit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-22 14:58:16 +00:00
nagachika
07fa1c9144 * test/thread/test_queue.rb (test_thr_kill): extend timeout.
this test takes a long time at slow machine.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-18 00:46:32 +00:00
naruse
24c3766624 The test added in r34034 needs to run thousands of times.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-14 02:26:17 +00:00
naruse
8cec0d5653 Add test for [Bug #5343] [ruby-core:39634]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-14 00:23:43 +00:00
nagachika
a46d29bb4e * lib/thread.rb (SizedQueue#max=) raise ArgumentError if max is not
positive number. patch by Masaki Matsushita.
  [ruby-dev:44449] [Bug #5259]

* test/thread/test_queue.rb (test_sized_queue_initialize,
  test_sized_queue_assign_max): add tests for it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-03 09:46:51 +00:00
nobu
3a47cf3395 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-15 11:55:52 +00:00
kazu
a350d0afc5 * test/thread/test_queue.rb (TestQueue#grind): fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-16 22:45:45 +00:00
mame
93c5002a7c * lib/thread.rb (Queue#push, #pop, SizedQueue#push, #pop): remove
code that kicks waiting thread twice, which caused race and
  deadlock.  [ruby-core:25537]

* test/thread/test_queue.rb: added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-16 11:10:08 +00:00