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

49 Коммитов

Автор SHA1 Сообщение Дата
kosaki 1ff6a1953c * thread.c (thread_cleanup_func): Moved interrupted_lock
destroying code from native_thread_destroy() to
          thread_cleanup_func() because it's platform independent logic.

        * thread_win32.c (native_thread_destroy): ditto.
        * thread_pthread.c (native_thread_destroy): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-20 15:20:17 +00:00
nobu f0445d156c * thread_win32.c (gvl_release, gvl_init): suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-28 05:55:49 +00:00
ko1 450463d5fb * thread.c, vm_core.h: make gvl_acquire/release/init/destruct
APIs to modularize GVL implementation.
* thread_pthread.c, thread_pthread.h: Two GVL implementations.
  (1) Simple locking GVL which is same as existing GVL.
  (2) Wake-up queued threads.  The wake-up order is simple FIFO.
  (We can make several queues to support exact priorities, however
  this causes some issues such as priority inversion and so on.)
  This impl. prevents spin-loop (*1) caused on SMP environemnts.
  *1: Only one Ruby thread acqures GVL again and again.
  Bug #2359 [ruby-core:26694]
* thread_win32.c, thread_win32.h: Using simple lock
  not by CRITICAL_SECTION but by Mutex.
  Bug #3890 [ruby-dev:42315]
* vm.c (ruby_vm_destruct): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-27 20:15:59 +00:00
usa f30e1877b2 * thread_win32.c (w32_error): should get error no only once, because
the result of the second getting will indicate the error of the
  first FormatMessage() call.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-27 06:08:37 +00:00
nobu 767d70841a * Makefile.in (ASFLAGS): needs INCFLAGS.
* configure.in (rb_cv_dynamic_alloca): check if extra source for
  dynamic size alloca.

* missing/x86_64-chkstk.s (___chkstk): necessary for alloca of
  amd64-mingw32msvc-gcc on Ubutu.

* thread_win32.c (ruby_alloca_chkstk): check stack overflow

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-26 09:09:45 +00:00
usa c94c6a1a16 * thread_win32.c (w32_error): get English message first, instead
of system default. see [ruby-core:32765].
  [experimental]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 03:10:49 +00:00
nobu cea3919ae6 * configure.in (RUBY_CHECK_PRINTF_PREFIX): check for printf format
specifier if possible.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 15:03:51 +00:00
wanabe 060f18c0d9 * thread_win32.c (w32_wait_events, w32_close_handle): suppress warnings.
see [ruby-core:31932].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-23 10:29:27 +00:00
usa 6198f539bb * thread_win32.c (native_thread_join): need to wait thread, of course.
[ruby-dev:41911]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-02 07:35:35 +00:00
akr f40d2c9670 * vm.c (Init_BareVM): call Init_native_thread here.
* thread.c (Init_Thread): don't call Init_native_thread.

* thread_pthread.c (Init_native_thread): exported.

* thread_win32.c (Init_native_thread): ditto.

[ruby-dev:41536]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-05 23:26:43 +00:00
wanabe bd21118627 * thread_win32.c (w32_wait_events): get GVL before handle interrupt
event.   [ruby-core:27199], [ruby-core:29698]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-05 11:53:03 +00:00
usa f9e536235b * thread_win32.c (ubf_handle): remove unused typedef.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-22 16:28:27 +00:00
usa dfc07e8aa7 * thread_win32.c (InterlockedExchangePointer): old SDK support.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-04 00:30:52 +00:00
usa 9f90682c4b * thread_win32.c (native_thread_destroy): decreased the probability of
using the interrupt event in the thread termination.
  see [ruby-core:27199].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-30 18:30:36 +00:00
usa 5bc85d6264 * thread_win32.c (w32_error): should report the function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-30 17:36:20 +00:00
nobu a000201fee * thread.c (rb_thread_atfork_internal): reinitialize global lock
at fork to get rid of deadlock.  based on the patch from Hongli
  Lai in [ruby-core:26783].  [ruby-core:26361]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-18 09:25:46 +00:00
nobu 9e0f3e0db9 * thread_win32.c (thread_errno): CreateThread does not set errno.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-12 05:33:23 +00:00
nobu 1d4183030d * thread.c (thread_create_core): moved failure handling from
native_thread_core().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-12 04:57:39 +00:00
usa 9ee5e613b5 * thread_{pthread,win32}.c (native_stop_timer_thread): join the thread
here.

* thread_{pthread,win32}.c (native_reset_timer_thread): new function.

* thread.c (rb_thread_stop_timer_thread, rb_thread_reset_timer_thread):
  call above function instead of simply seting 0.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-02 03:58:25 +00:00
nobu c7853b4344 * eval.c (ruby_cleanup): the order of local variables on stack is
undefined.  should use outermost VALUE for ruby_init_stack.

* gc.c (ruby_get_stack_grow_direction, Init_stack): allows volatile
  pointer.

* thread_*.c (ruby_init_stack): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-19 05:43:20 +00:00
usa b451955bbb * thread_win32.c (Init_native_thread): need to call
ruby_thread_set_native() here.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-22 10:12:02 +00:00
nobu 641f43de97 * thread_pthread.c (thread_timer): checks working flags again.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-08 15:31:05 +00:00
nobu df6ea23faf * thread_win32.c (thread_start_func_1): use already gotten stack info.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-07 12:23:15 +00:00
nobu 5732566f4d * thread.c (rb_thread_stop_timer_thread): terminates timer thread
immediately.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-06 13:21:26 +00:00
usa 3c8dca55c4 * win32/win32.c, include/ruby/win32.h (rb_w32_open): overlapped file
I/O support.

	* win32/win32.c, include/ruby/win32.h (rb_w32_pipe): overlapped pipe
	  I/O support.

	* wn32/win32.c (rb_w32_read, rb_w32_write): overlapped I/O support to
	  enable canceling I/O.

	* thread_win32.c (ubf_handle): remove workaround.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-28 12:46:58 +00:00
ko1 16612b360b * thread.c, vm_core.h: add manual priority support
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
2008-08-13 07:53:35 +00:00
usa a73ba1def7 * thread_win32.[ch] (cond_every_entry, rb_thread_cond_struct): reverted
r18239 because r18245 made the changes unnecessary.

	* thread.c (rb_mutex_struct): define after including thread_{pthread,
	  win32}.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-28 12:27:43 +00:00
usa 9b3aade1b6 * thread_win32.[ch]: moved definitions of cond_every_entry and
rb_thread_cond_struct from .c to .h because rb_thread_cond_struct
	  is used in vm_core.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-28 07:02:07 +00:00
usa f92478c0fb * win32/win32.c (overlapped_socket_io): avoid warnings.
* thread_win32.c (ubf_handle): refactoring.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-24 07:05:49 +00:00
nobu 47e3f4e1ae * thread.c (thread_start_func_2): wake up joining threads.
* thread.c (sleep_forever, sleep_timeval): return when interrupted.
  [ruby-dev:35542]

* thread.c (timer_thread_function): restore main thread status.
  [ruby-core:17270]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-16 19:19:36 +00:00
usa 25498d24c8 * thread_win32.c (ubf_handle): cancel blocking IO if it can (only
Vista). see [ruby-dev:35446]

	* win32/win32.c (errmap): add ERROR_OPERATION_ABORTED as EINTR.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-15 09:14:09 +00:00
nobu a14682906f * thread.c (sleep_forever): wait until timed out. [ruby-core:17270]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-09 13:41:19 +00:00
nobu 7df7982b47 * thread_{pthread,win32}.c (native_sleep): wait until timed out.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-09 11:35:06 +00:00
nobu a534e39a87 * thread_{pthread,win32}.c (rb_thread_create_timer_thread): needs more
stack for debug.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-09 09:17:09 +00:00
nobu 6bbbf9889d * thread.c (thread_initialize): NUM2INT() returns int.
* thread.c (timer_thread_function), thread_pthread.c (thread_timer),
  thread_win32.c (timer_thread_func), thread_{pthread,win32}.c
  (rb_thread_create_timer_thread): passing VM.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-05 13:22:29 +00:00
usa 8724448ed5 * thread_win32.c (native_sleep): must block reentrance when accessing
th->unblock.
	  fixed [ruby-core:17341], reported by Bill Kelly <billk at cts.com>



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-21 07:48:29 +00:00
ko1 af94c81302 * thread_win32.c (native_sleep): fix to decrement sleeper count.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-19 15:19:38 +00:00
mame 4b645dc8f3 * thread.c, thread_win32.c, vm_core.h: try to remove false positive of
deadlock detection.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-19 14:18:46 +00:00
nobu fc3c60f608 * gc.h (STACK_UPPER): moved from gc.c
* thread.c, thread_{pthread,win32}.c (ruby_init_stack,
  ruby_thread_init_stack): moved stack initialization from gc.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-14 02:59:19 +00:00
usa 4b022866ee * thread_win32.c (native_sleep): fixed previous commit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-12 13:20:55 +00:00
mame 6f5aaff73b * thread.c, vm_core.h, vm.c, thread_pthread.c, thread_win32.c: add
deadlock detection.  [ruby-dev:35044]

* bootstraptest/test_thread.rb: add tests for above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-12 13:01:38 +00:00
nobu 1b63d7bc92 * vm_core.h (struct rb_unblock_callback), thread.c
(set_unblock_function), thread_{pthread,win32}.c (native_sleep):
  extracted from struct rb_thread_struct.

* thread.c (reset_unblock_function): not check interrupts at leaving
  blocking region.  [ruby-dev:34874]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-30 01:52:38 +00:00
nobu 87e4ad0a23 * io.c, signal.c, thread.c, thread_win32.c, include/ruby/intern.h:
suppress warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-26 09:36:35 +00:00
usa caa539f2a3 * thread_win32.c (w32_wait_events): shouldn't invoke interrupt handle
by timer_thread.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-18 15:15:40 +00:00
nobu 3a4bfbad09 * thread.c (thread_cleanup_func): ignore errors from destroying mutex
of dead thread.  [ruby-core:15069]

* thread_pthread.c, thread_win32.c (native_thread_destroy): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-18 06:57:08 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
ko1 42f0b52f77 * thread_pthread.c, thread_pthread.h, thread_win32.c,
thread_win32.c: make some functions static functions.
  a patch from Tadashi Saito <shiba AT mail2.accsnet.ne.jp>
  in [ruby-core:14407]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 04:35:17 +00:00
ko1 5f0b8afb97 * vm_core.h, thread.c, cont.c: add RUBY_VM_SET_INTERRUPT(),
RUBY_VM_SET_TIMER_INTERRUPT(), RUBY_VM_INTERRUPTED().
* thread.c, thread_pthread.c, thread_win32.c: fix to ignore time slice
  event until sleep.
* bootstraptest/test_thread.rb: add a test for time limited join test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 04:16:06 +00:00
ko1 c334a09f7a * common.mk, *.ci: renamed to *.c.
* eval_laod.c: renamed to load.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-20 09:29:46 +00:00