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

17 commits

Author SHA1 Message Date
nobu
13d241489a thread.c: no function callsin RARRAY_LEN
* ext/thread/thread.c (queue_length, queue_num_waiting): avoid
  function calls in RARRAY_LEN macro which evaluates the argument
  multiple times.

* ext/thread/thread.c (rb_szqueue_num_waiting): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-07 16:36:16 +00:00
nobu
a198bb3929 thread.c: check initialized
* ext/thread/thread.c (get_array): check instance variables are
  initialized properly.  [ruby-core:63826][Bug #10062]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-19 01:13:24 +00:00
hsbt
eb95f194ba * ext/thread/thread.c: added nodoc attribute into
'ConditionVariable#marshal_dump' by @vipulnsward
  [fix GH-672]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-19 16:00:51 +00:00
nobu
083c5896ca thread/thread.c: simplify
* ext/thread/thread.c (queue_pop_should_block): returns int
  instead of VALUE, and use rb_check_arity.

* ext/thread/thread.c (szqueue_push_should_block): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-17 10:57:31 +00:00
nobu
4c849f0e62 thread/thread.c: non-blocking push on SizedQueue
* ext/thread/thread.c (rb_szqueue_push): add optional parameter,
  non_block defaulted to false.  [ruby-core:63794] [Feature #10052]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-17 10:57:13 +00:00
nobu
1dd527012b thread.c: undumpable
* ext/thread/thread.c (undumpable): ConditionVariable and Queue
  are not dumpable.  [ruby-core:61677] [Bug #9674]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 02:20:26 +00:00
normal
2d603f9fee ext/thread: SizedQueue#max= wakes up waiters properly
* ext/thread/thread.c (rb_szqueue_max_set): use correct queue and
	  limit wakeups.  [Bug #9343][ruby-core:60517]
	* test/thread/test_queue.rb (test_sized_queue_assign_max):
	  test for bug

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-05 23:35:06 +00:00
nobu
06d2e8aaf7 thread/thread.c: no dup
* ext/thread/thread.c (Init_thread): ConditionVariable and Queue
  are not able to copy.  [ruby-core:59961] [Bug #9440]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-22 06:59:41 +00:00
glass
79e69ec715 * ext/thread/thread.c (rb_szqueue_clear): notify SZQUEUE_WAITERS
on SizedQueue#clear. [ruby-core:59462] [Bug #9342]

* test/thread/test_queue.rb: add test. the patch is from
  Justin Collins.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-14 12:14:48 +00:00
charliesome
64926db998 * ext/thread/thread.c (rb_szqueue_push): check GET_SZQUEUE_WAITERS
instead of GET_QUEUE_WAITERS to prevent deadlock. Patch by Eric Wong.
  [Bug #9302] [ruby-core:59324]

* test/thread/test_queue.rb: add test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-13 03:18:38 +00:00
ktsj
2251a2729a * ext/thread/thread.c: [DOC] add call-seq alias for Queue#enq, #<<, etc.
* ext/thread/thread.c (Init_thread): use rb_define_alias instead of
  rb_alias to document alias.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-09 15:47:35 +00:00
zzak
af5e21292c * ext/thread/thread.c: [DOC] This patch accomplishes the following:
- Teach RDoc about ConditionVariable
  - Teach RDoc about Queue
  - Teach RDoc about SizedQueue
  - Use fully-qualified namespace for Document-method
    This is necessary to separate definitions between classes
  - Fix rdoc bug in call_seq vs. call-seq
  - Correct doc for SizedQueue#pop patch by @jackdanger [Bug #8988]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-13 17:37:47 +00:00
nobu
13e60f2bff * ext/thread/thread.c (ALIAS_GLOBAL_CONST): fix typo, GLOBCAL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-02 18:20:17 +00:00
nobu
cb2b598024 * ext/thread/thread.c (Init_thread): move outer module condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-02 18:20:14 +00:00
nobu
6bca9dc372 thread.c: invert
* ext/thread/thread.c (queue_pop_should_block): the first argument of
  Queue#pop is non_block and inverted for should_block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-07 19:04:39 +00:00
nobu
398c3cab6d thread.c: function cast
* ext/thread/thread.c (queue_sleep): get rid of casting function
  pointer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-07 19:04:37 +00:00
glass
e334bb2ce5 * common.mk: use RUNRUBY instead of MINIRUBY because MINIRUBY can't
require extension libraries. The patch is from nobu
  (Nobuyoshi Nakada).

* ext/thread/extconf.rb: for build ext/thread/thread.c.

* include/ruby/intern.h: ditto.

* thread.c: ditto.

* lib/thread.rb: removed and replaced by ext/thread/thread.c.

* ext/thread/thread.c: Queue, SizedQueue and ConditionVariable
  implementations in C. This patch is based on patches from panaggio
  (Ricardo Panaggio) and funny_falcon (Yura Sokolov) and  ko1
  (Koichi Sasada). [ruby-core:31513] [Feature #3620]

* test/thread/test_queue.rb (test_queue_thread_raise): add a test for
  ensuring that killed thread should be removed from waiting threads.
  It is based on a code by ko1 (Koichi Sasada). [ruby-core:45950]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-06 15:15:07 +00:00