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

225 Коммитов

Автор SHA1 Сообщение Дата
nobu 76fa0d6615 * thread.c: added rdocs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-17 04:51:33 +00:00
nobu a289f7a4b1 * thread.c (rb_thread_s_debug_set): set level, not only boolean.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-17 04:50:52 +00:00
marcandre 1796522f10 * thread.c (rb_exec_recursive_outer, rb_exec_recursive): Added method to 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
2009-09-15 21:30:50 +00:00
nobu 60f545e2ac * thread.c (thread_list_access): prototyped.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-13 05:09:15 +00:00
marcandre 8b0cb325f5 * thread.c (recursive_*): refactored the access to the inspect table used by
rb_exec_recursive_*. The functions recursive_push, pop and check now assume
  a valid hash table as their first argument. Added documentation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-13 04:45:54 +00:00
nobu 1a7221035a * thread.c (thgroup_data_type, mutex_data_type, barrier_data_type):
typed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09 03:21:14 +00:00
nobu 31b7ae00c0 * include/ruby/st.h (st_hash_func): use st_index_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-08 13:10:04 +00:00
naruse 18b17dcd19 Revert wrong commit r24715 "* thread.c (do_select): suppress warnings."
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-30 08:06:24 +00:00
naruse 2a12798d58 * thread.c (do_select): suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-30 08:00:14 +00:00
usa 12a4e27f17 * thread.c (do_select): rollback r24680. void struct initializer is
invalid.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-28 04:35:29 +00:00
nobu fec3877e8d * thread.c (do_select): suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-26 23:18:49 +00:00
akr 832fd6825c * thread.c (rb_thread_schedule): don't recur infinitely.
(rb_threadptr_execute_interrupts): ditto.
  [ruby-dev:38060]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-22 16:19:18 +00:00
mame f72b854c7d * thread.c (rb_check_deadlock): decrease number of sleepers before
deadlock detection because the deadlock exception makes main thread
  run.  [ruby-dev:39142]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-21 15:14:29 +00:00
matz ec5e3c551d * thread.c (rb_thread_terminate_all): do not ignore interrupt when
reaping threads on termination.  [ruby-dev:39107]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-20 00:42:16 +00:00
matz d6b9cc7baa * thread.c (recursive_push): need to set UNTRUST. [ruby-dev:38997]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-03 20:45:52 +00:00
matz 0f1c1ecbd8 * thread.c (recursive_push): untrust internal hash to prevent
unexpected SecurityError.  a patch from Kazuhiro NISHIYAMA.
  Fix: #1864  [ruby-dev:38982]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-03 09:15:09 +00:00
nobu b35d1e714c * thread.c (rb_threadptr_exec_event_hooks): new function to
execute event hooks, with preserving errinfo.  [ruby-core:24118]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-05 05:04:41 +00:00
matz 945ea61cd7 * thread.c (ruby_thread_stack_overflow): call rb_exc_raise() on
stack overflows in the signal handler, if sigaltstack is
  available.  On stack overflow (and with sigaltstack), the signal
  handler is more likely to have room to create an exception
  object.  [ruby-core:23813]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-17 03:56:29 +00:00
ko1 63bd8a74e8 * thread.c, vm_eval.c: add Thread.backtrace.
* 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
2009-06-14 05:59:23 +00:00
ko1 79b62da9b4 * thread.c: rename functions which require a parameter
"rb_thread_t *", the prefix to be rb_threadptr_ instead of
  rb_thread_.
* thread.c (rb_thread_add_event_hook(), rb_thread_remove_event_hook):
  change the parameter type from rb_thread_t * to VALUE.
* eval.c, eval_error.c, eval_intern.h, signal.c, vm_core.h, vm_eval.c:
  ditto.
* include/ruby/intern.h: remove decl of rb_thread_signal_raise() and
  rb_thread_signal_exit().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-08 16:14:06 +00:00
nobu 02fb261ec1 * thread.c (rb_exec_recursive_paired): new function for proper
handling of recursive arrays.  [EXPERIMENTAL] [ruby-core:23402]

* array.c (rb_ary_equal, rb_ary_eql, rb_ary_cmp): use above.

* hash.c (hash_equal): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-24 13:48:23 +00:00
nobu 46be98a8cf * thread.c: fixed types.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-09 03:25:16 +00:00
matz d98da36b8c * thread.c (rb_thread_fd_select): new function to call select
using rb_fdset_t.

* io.c (select_internal): use rb_thread_fd_select instead of
  rb_thread_select.  based on the patch from Kengo Matsuyama.
  [ruby-dev:38221]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-01 04:56:51 +00:00
nobu d1abc53721 * array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,
numeric.c, pack.c, strftime.c, string.c, thread.c, transcode.c,
  transcode_data.h, util.c, variable.c, vm_dump.c,
  include/ruby/encoding.h, missing/crypt.c, missing/vsnprintf.c:
  suppress VC type warnings.  [ruby-core:22726]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:16:15 +00:00
akr cfe9dcb886 * eval_error.c (error_print): use volatile to suppress warnings.
* vm_eval.c (eval_string_with_cref): ditto.

* thread.c (rb_exec_recursive): ditto.

* eval_jump.c (rb_exec_end_proc): ditto.

* eval.c (ruby_exec_node): ditto.
  (rb_longjmp): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-28 11:12:36 +00:00
mame c55dd9b7d8 * thread.c (thread_cleanup_func): unlock all locked mutexes even when
forking.  [ruby-core:22269]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-23 16:20:06 +00:00
nobu 28ec52c087 * thread.c (thread_start_func_2): do not delete main thread from
living_threads.  [ruby-core:19385], [ruby-core:22158]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-18 01:29:13 +00:00
nobu 04e2a72f1e * thread.c: inline should be at beginning of declaration.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-12 07:21:42 +00:00
nobu 845103b751 * cont.c (rb_fiber_current), dln.c (dln_print_undef, dln_undefined),
eval.c (rb_iterator_p, rb_need_block), load.c: (Init_load), ruby.c
  (uscore_get, rb_f_chop), st.c (stat_col), signal.c
  (rb_signal_buff_size, ruby_sig_finalize), thread.c
  (rb_thread_sleep_forever, rb_thread_sleep_deadly, rb_thread_alone):
  protoized.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-01 12:51:44 +00:00
nobu 3899c1bed7 * thread.c (rb_time_timeval): made a real prototype. a patch from
Marcus Rueckert <darix AT opensu.se> at [ruby-core:21492].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-22 02:31:54 +00:00
nobu 4c4aef3bbe * thread.c (rb_thread_execute_interrupts): needs
rb_signal_buff_size to be declared.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 05:32:05 +00:00
ko1 cf23d0f0f0 * vm.c: add a prefix "rb_" to exposed functions
vm_get_ruby_level_next_cfp(), rb_vm_make_env_object(),
  vm_stack_to_heap(), vm_make_proc(), vm_invoke_proc(),
  vm_get_sourceline(), vm_cref(), vm_localjump_error(),
  vm_make_jump_tag_but_local_jump(), vm_jump_tag_but_local_jump().
  This changes may affect only core because most of renamed functions
  require a pointer of not-exposed struct such as rb_thread_t or NODE.
  In short, they are core functions.
* cont.c, eval.c, eval_intern.h, load.c, proc.c, thread.c,
  vm_core.h, vm_dump.c, vm_eval.c, vm_exec.c, vm_insnhelper.c:
  ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 02:38:11 +00:00
ko1 a04df27e72 * thread.c (thread_start_func_2): call ruby_cleanup() if thread is
main thread.  [ruby-dev:37624]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-16 03:42:50 +00:00
mame 3e7c34140c * thread.c (rb_thread_execute_interrupts): if signal is already
buffered, main thread should wait until timer thread delivers it.

* thread.c (timer_thread_function): should defer delivery of a signal
  if main thread does not yet trap a previous one.  [ruby-dev:37676]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 17:27:31 +00:00
ko1 d9395fc466 * thread.c (call_trace_proc): as Matz said ([ruby-core:21183]),
should skip rb_str_new2() if rb_sourcefile() returns NULL.
  rb_sourcefile() returns NULL if frame is toplevel of Fiber.
  [ruby-core:21161] [Bug #985]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 16:45:41 +00:00
usa 50258b19fd * include/ruby/intern.h, thread.c, win32/Makefile.sub (rb_fdset_t,
rb_fd_init, rb_fd_term, rb_fd_zero, rb_fd_set, rb_fd_clr, rb_fd_isset,
	  rb_fd_select, rb_fd_ptr, rb_fd_max, HAVE_RB_FD_INIT): new type,
	  functions, and macros for Windows.

	* win32/win32.c (extract_fd, rb_w32_select): use rb_fdset_t to expand
	  fd_array if needed.  [ruby-core:19946]

	* win32/win32.c (copy_fd): new funcion for rb_w32_select().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-13 07:52:22 +00:00
ko1 6f09fc2efd * thread.c: fix comment (terminology: Global VM Lock).
* thread.c (blocking_region_begin, blocking_region_end):
  save and clear th->blocking_region_buffer.
* thread.c (rb_thread_call_with_gvl): check if it has GVL.
* thread.c (ruby_thread_has_gvl_p): added.
* vm_core.h: add decls.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-12 01:43:23 +00:00
kazu 38c5409667 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-05 06:55:14 +00:00
ko1 9c04a0647f * thread.c (rb_thread_blocking_region): add a comment.
* thread.c (rb_thread_call_without_gvl): added as a alias of
  rb_thread_blocking_region().
* thread.c (rb_thread_call_with_gvl): added.
* vm_core.h (rb_thread_t#blocking_region_buffer): added for
  rb_thread_call_with_gvl().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-30 07:57:53 +00:00
ko1 b2ad49565f * thread.c (rb_mutex_trylock): return false if Mutex owned
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
2008-12-29 03:03:09 +00:00
mame b66af67f21 * thread.c (mutex_free, mutex_unlock): add qualifiers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-28 03:25:31 +00:00
mame 0e41458700 * thread.c (mutex_free): GC thread (main thread) has failed to unlock
a mutex that is locked by another thread, which makes the mutex
  dangling in keeping_mutexes and causes [BUG] or stuck finally.
  Now unlocking is performed as locking thread.

* thread.c (mutex_unlock, rb_mutex_unlock, rb_mutex_unlock_all):
  mutex_unlock receives a thread.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-28 01:39:18 +00:00
nobu a94adfa245 * process.c (after_exec): needs to reset before restart timer
thread.

* thread.c (thread_start_func_2): stops timer thread if forked in
  the new thread.   [ruby-core:19385]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-27 10:40:57 +00:00
nobu b5d2750bbc * thread.c (rb_thread_atfork, rb_thread_atfork_before_exec): DRY.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-27 10:30:04 +00:00
nobu 011fc2649d * thread.c (thread_start_func_2): sets native thread key.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-24 16:52:38 +00:00
akr b795b5c537 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-22 12:29:04 +00:00
matz 13919e068b * thread.c (sleep_timeval): cast tv_usec to long to shut up
warnings on OSX.  [ruby-dev:37449]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-15 14:49:31 +00:00
matz bd4d9e9a35 * thread.c (rb_mutex_unlock): shut up warning. a patch from
Kazuhiro NISHIYAMA in [ruby-dev:37345]. fix #846

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-10 16:30:40 +00:00
nobu 541915b239 * compile.c (iseq_compile_each), gc.c (assign_heap_slot),
(gc_mark_children), parse.y (vtable_alloc, vtable_free, vtable_add),
  proc.c (proc_to_s), thread.c (terminate_i, rb_thread_terminate_all),
  (thread_start_func_2, blocking_region_begin, blocking_region_end),
  (rb_thread_kill), thread_pthread.c (native_thread_create),
  (ubf_pthread_cond_signal), vm.c (check_env, thread_free), vm_dump.c
  (vm_env_dump_raw, vm_stack_dump_each, vm_thread_dump_state),
  (vm_call0): use void pointer for %p.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-09 04:33:55 +00:00
akr e44a6c4708 move the previous comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-02 10:00:10 +00:00