Граф коммитов

18 Коммитов

Автор SHA1 Сообщение Дата
ko1 bfdfc99cc2 allow Queue operation in trap.
* thread_sync.c: allow spurious wakeup to check Queue status just after trap.
  [Bug #12405]

* test/thread/test_queue.rb: add a test for it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-31 07:00:38 +00:00
ko1 6897b3b985 define rb_thread_sleep_deadly_allow_spurious_wakeup().
* thread.c, thread_sync.c: define new function
  rb_thread_sleep_deadly_allow_spurious_wakeup() and use it instead of
  using sleep_forever() directly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-31 06:39:01 +00:00
ko1 919a9d9e02 use TRUE/FALSE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-31 06:31:06 +00:00
nobu 325587ee7f thread_sync.c: Document exception types
* thread_sync.c (rb_queue_pop, rb_szqueue_push, rb_szqueue_pop):
  Document exception types, ThreadError, raised by Queue and
  SizedQueue.  [Fix GH-1451]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-29 10:34:25 +00:00
nobu 084487a372 thread_sync.c: Remove confusing comments
* thread_sync.c (Init_thread_sync): Remove confusing doc comments,
  which are picked up by rdoc unexpectedly, from Queue and
  SizedQueue.  [Fix GH-1450]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-29 10:21:04 +00:00
nobu 56695b35de thread_sync.c: alias_global_const
* thread_sync.c (alias_global_const): extract from a macro.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-28 08:53:22 +00:00
nobu c463366dfd rb_funcallv
* *.c: rename rb_funcall2 to rb_funcallv, except for extensions
  which are/will be/may be gems.  [Fix GH-1406]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-29 11:57:14 +00:00
nobu a46df859cc thread.c: clear atfork functions
* thread.c (rb_thread_atfork, rb_thread_atfork_before_exec): do
  nothing unless working fork is available.
* thread_sync.c (rb_mutex_abandon_all): define only if working
  fork is available.
* thread_sync.c (rb_mutex_abandon_keeping_mutexes): ditto.
* thread_sync.c (rb_mutex_abandon_locking_mutex): ditto.
* thread_win32.c (gvl_init): never used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-09 01:46:37 +00:00
nobu 13d62659ce thread_sync.c: define global constants always
* thread_sync.c (ALIAS_GLOBAL_CONST): define global constant
  aliases unconditionally.  same constants are not defined at this
  time.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 02:55:18 +00:00
nobu fe9817618d thread_sync.c: Update rdoc for Queue [skip ci]
* thread_sync.c: [DOC] Update documentation for Queue class
  description.  [Fix GH-1292]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 08:20:29 +00:00
sho-h 571fb5b687 thread_sync.c: [DOC] remove SizedQueue#close argument. [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-04 06:38:26 +00:00
normal 004bb16ccc thread_sync.c: remove unnecessary casts for queue_sleep
"Qfalse" and "(VALUE)0" are equivalent, and do not matter
for an ignored argument, either.

Additionally, there's no reason to cast the pointer to
rb_thread_sleep_deadly when we already have a queue_sleep
wrapper.

* thread_sync.c (queue_do_pop): avoid cast with Qfalse
  (rb_szqueue_push): ditto, use queue_sleep wrapper

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-02 12:08:34 +00:00
normal 5ad289b133 thread_sync.c: static classes
We do not want to waste space by exposing globals to other
objects.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-28 21:52:15 +00:00
ko1 2f5b8f0529 * *.c (*_memsize): do not check ptr.
NULL checking is finished Before call of memsize functions.
  See r52979.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 00:38:32 +00:00
ko1 e2609033ab * thread_sync.c: reduce the specification of Queue#close.
* Queue#close accepts no arguments.
  * deq'ing on closed queue returns nil, always.
  [Feature #10600]

* test/thread/test_queue.rb: catch up this fix.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-21 00:32:09 +00:00
nobu aabd765f0b thread_sync.c: fix typos
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-03 15:17:25 +00:00
ko1 c37c67cef8 * thread_sync.c (queue_do_close): ignore multiple close to allow
multiple producers.
  https://bugs.ruby-lang.org/issues/10600#note-14



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-01 09:17:28 +00:00
ko1 dcf6ac4975 * thread_tools.c: rename thread_tools.c to thread_sync.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-01 09:08:42 +00:00