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

70 Коммитов

Автор SHA1 Сообщение Дата
akr b73ea4b64a * thread_pthread.c (native_sleep): suppress a warning for platforms
which time_t is int.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-19 10:29:30 +00:00
mame 6e7f56fdc7 * thread_pthread.c (get_stack): fix memory leak; pthread_attr_destory
must be called even when pthread_getattr_np is used.
  [ruby-core:31269]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-22 11:15:16 +00:00
naruse 6957c6d9cf * thread_pthread.c (thread_start_func_1): don't call
native_thread_init_stack(th) on cygwin to avoid the segv
  introduced by r27789. Cygwin's signal implementation is half
  baked so USE_SIGNALSTACK is not defined and it needs another
  treatment.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-01 07:25:20 +00:00
kanemoto 78d48a330d * thread_pthread.c (get_stack): use pthread_getthrds_np() for AIX.
* configure.in: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-29 17:29:27 +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
mame 50587316b8 * vm_core.c (rb_thread_struct): add a field for sigaltstack.
* thread_pthread.c (thread_start_func_1): initialize machine stack
  information.

* thread.c (thread_start_func_2): set sigaltstack for each sub thread.
  [ruby-core:24540] [ruby-core:30207]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-13 16:20:26 +00:00
nobu 89cc2aef81 * cont.c (stackgrowdirection): removed duplicated code, use
STACK_UPPER macro instead.

* gc.h (STACK_DIR_UPPER): moved from thread_pthread.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-08 16:15:20 +00:00
nobu 95c52c8e6c * gc.c (GET_STACK_BOUNDS): fixed macro argument names. a patch from
Satoshi Shiba <shiba AT rvm.jp> at [ruby-dev:40973].

* gc.h (ruby_get_stack_grow_direction): fixed prototype.

* thread_pthread.c (get_stack, ruby_stack_overflowed_p): both side
  should be same type.  [Bug #3145]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-14 07:29:04 +00:00
naruse b323b86b6b * thread_pthread.c (native_thread_init_stack): use get_stack.
patched by KOSAKI Motohiro [ruby-dev:40309]

* thread_pthread.c (ruby_init_stack): use get_stack
  on platforms which have pthread_attr_get_np.
  (FreeBSD, DragonFlyBSD and NetBSD)
  This is because FreeBSD and DragonFly BSD must use
  pthread_attr_get_np to get stack size of main thread,
  but Mac OS X and Linux with LinuxThreads must use getrlimit.
  <http://www.nminoru.jp/~nminoru/programming/stackoverflow_handling.html>
  <http://d.hatena.ne.jp/nurse/20100204>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-04 07:17:03 +00:00
naruse 44b5a74a9a * thread_pthread.c: DragonFlyBSD is also the same as FreeBSD
on getting the stack size of the main thread.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-03 04:17:19 +00:00
naruse fb15c0f16c * thread_pthread.c (ruby_init_stack): use pthread_get_attr_np
to get the stack size of the main thread on FreeBSD.

* thread_pthread.c: include pthread_np.h on FreeBSD.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-03 03:35:11 +00:00
yugui 295bc2fe25 removes the dtrace support. reverts r26239, r26238 and r26235.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-05 05:59:23 +00:00
yugui 72b199940d * trace.h: new file. wraps tracing mechanisms.
* defs/dtrace.d: new file. defined a dtrace provider "ruby".

* include/ruby/ruby.h (LIKELY): moved from vm.c.
  (UNLIKELY): ditto.
  (OBJSETUP): probe "object-create".
  (RUBY_EVENT_RESCUE): new event.

* vm_exec.c (DEBUG_ENTER_INSN): embeded a probe insn-entry into it.
  (DEBUG_END_INSN): insn-return.

* vm.c (LIKELY): moved into ruby.h.
  (UNLIKELY): ditto.
  (Init_BareVM): embeded a probe "raise" into it.

* variable.c (rb_class2name_without_alloc): new utility function.

* tool/rbinstall.rb (install?(:ext, :arch, :'ext-arch')): installs 
  dtrace.d if necessary.

* thread_pthread.c (add_signal_thread_list): probe "raise".
  (rb_thread_create_timer_thread): ditto.

* thread.c (rb_thread_schedule_rec): probes "thread-enter" and
  "thread-leave",
  (thread_start_func_2): ditto.
  (thread_cleanup_func): probe "thread-term"

* lib/mkmf.rb: supports dtrace postprocessor on making an extension.

* iseq.c (rb_vm_insn_name): new utility function.
  (rb_vm_insn_len): ditto.

* insns.def (hook): probes "method-etnry", "method-return", "line",
  and "rescue".

* compile.c (iseq_compile_each): adds a trace op for "rescue" probe.

* gc.c (garbage_collect): probes "gc-begin" and "gc-end".
  (obj_free): probe "object-free"
  (garbage_collect_with_gvl): probe "raise"
  (negative_size_allocation_error): ditto.
  (rb_memerror): ditto.

* eval.c (rb_rescue2): probe "rescue"
  (rb_longjmp): probe "raise"

* ext/probe/probe.c: new extension for application defined probes.

* ext/probe/extconf.rb: ditto.

* configure.in (--with-tracing-model): new option to choose a tracing
  mechanism.
  (DTRACE): new substitution. name of dtrace(1).
  (RUBY_TRACING_MODEL): new substitution.
  (DTRACE_OBJ): ditto.
  (MINIDTRACE_OBJ): ditto.
  (GOLFDTRACE_OBJ): ditto.
  (LIBRUBY_DTRACE_OBJ): ditto.
  (RUBY_DTRACE_POSTPROCESS): new macro. checks whether the dtrace on 
  the system needs postprocessing.
  (RUBY_DTRACE_BSD_BROKEN): new macro. checks whether the dtrace
  supports USDT.

* Makefile.in: 
  (DTRACE): new variable. name of dtrace(1).
  (TRACING_MODEL): new variable. name of the chosen tracing mechanism.
  (DTRACE_OBJ): same as the one in configure.in.
  (MINIDTRACE_OBJ): ditto.
  (GOLFDTRACE_OBJ): ditto.
  (LIBRUBY_DTRACE_OBJ): ditto.
  (CPPOUTFILE): new substitution. necessary for generating dtrace.d
  (trace_none.h): new target for TRACING_MODEL=none
  (RUBY_H_INCLUDES): appended a header for tracing.
  (distclean-local): also removes preprocessed version of dtrace.d
  ($(LIBRUBY_A)): needs $(LIBRUBY_DTRACE_OBJ) if dtrace needs 
  postprocessing.
  ($(PROGRAM)): ditto.
  (golf): ditto.
  (miniruby): ditto.
  ($(arch_hdrdir)/ruby/dtrace.d): new target. preprocessed verson 
  of defs/dtrace.d. generated if necessary.
  ($(arch_hdrdir)/ruby/trace_dtrace.h): new target.
  definition of probes.
  ($(LIBRUBY_DTRACE_OBJ)): new target. generated if dtrace needs 
  postprocessing.
  ($(DTRACE_OBJ)): ditto.
  ($(MINIDTRACE_OBJ)): ditto.
  ($(GOLFDTRACE_OBJ)): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-03 15:36:17 +00:00
nobu 4ba0fe5fd3 * thread_pthread.c (native_mutex_reinitialize_atfork): release and
re-acquire the lock at re-initialization.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-10 06:49:15 +00:00
akr ff9d908832 * include/ruby/ruby.h (rb_bug_errno): declared.
* include/ruby/intern.h (rb_strerrno): declaration removed.

* error.c (rb_strerrno): make it static.  return NULL for unknown
  errors.
  (rb_bug_errno): defined.

* thread_pthread.c: use rb_bug_errno.

* signal.c (ruby_signal): use rb_bug_errno.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24 11:03:51 +00:00
akr 3302b8fff5 * include/ruby/intern.h (rb_strerrno): declared.
* template/known_errors.inc.tmpl: generate defined_error() and
  undefined_error() instead of set_syserr.

* error.c (Init_syserr): define defined_error() and undefined_error()
  to follow the above change.
  (rb_strerrno): defined.

* thread_pthread.c: show error message and errno macro name with
  rb_bug.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24 00:26:52 +00:00
nobu a80eb26a18 * thread_pthread.c (RUBY_STACK_MIN, RUBY_STACK_SPACE): delay for
platforms where PTHREAD_STACK_MIN is not compile time constant.
  [ruby-dev:39751]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-23 07:06:54 +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 a7d63dfd28 * thread_pthread.c: removed last comma of enum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-12 05:00:47 +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
nobu a360a8ce85 * thread_pthread.c (native_thread_create): constified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-12 04:31:02 +00:00
usa 409033efca * thread_pthread.c (native_stop_timer_thread): delay joinning timer
thread after unlocking mutex.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-02 05:45:35 +00:00
usa 12fadc1022 * thread_pthread.c (native_stop_timer_thread): need to join timer thread
only when really stopping it.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-02 04:32:28 +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
ko1 0cdfbc9446 * thread_pthread.c (rb_thread_create_timer_thread): print fatal error
message to stderr instead of using rb_bug().
* KNOWNBUGS.rb, bootstraptest/test_fork.rb: move a fixed test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-07 23:59:58 +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
nobu bb1811d6a3 * thread_pthread.c (ruby_init_stack): range of rlim_cur may be
larger than int.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-11 20:12:56 +00:00
nobu be7679308b * gc.c (ruby_get_stack_grow_direction): no needs to use thread
here, and not initialized yet.  [ruby-core:22439]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-27 09:01:21 +00:00
azav 07a2506527 thread_pthread.c (native_thread_create) [__SYMBIAN32__]: reduced pthread stack size
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-06 13:35:15 +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
naruse d4b3e8ae70 * signal.c (rb_signal_buff_size): defined for check whether signal
is in the buffer or not.

* thread_pthread.c (thread_timer): don't exit the loop when signal
  is in the buffer. [ruby-dev:37637]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-01 21:50:01 +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
nobu 7348aa6113 * gc.c (ruby_stack_check): no check if using sigaltstack.
* signal.c (register_sigaltstack): minimum size is insufficient for
  method calls.

* signal.c (sigsegv): handles stack overflow if possible.

* thread.c (ruby_thread_stack_overflow): helper function to raise
  sysstack_error.

* thread_pthread.c (ruby_stack_overflowed_p): checks for stack
  overflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-27 06:05:07 +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 b15e0697fd * thread_pthread.c (rb_thread_create_timer_thread): do not wait never
coming signal if failed to create tiemr thread.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-07 16:48:22 +00:00
nobu 006be2d790 * thread_pthread.c (native_cond_timedwait): returns error code.
* thread_pthread.c (thread_timer): typo fixed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-07 16:42:31 +00:00
nobu 8da157ae51 * thread_pthread.c (thread_timer, rb_thread_create_timer_thread):
handshakes properly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-07 16:14:48 +00:00
nobu b81ccf3167 * thread_pthread.c (thread_timer): fixed typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-07 13:47:11 +00:00
nobu 3899005d2e * thread_pthread.c (thread_timer): initializes mutex each time.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-07 13:42:36 +00:00
nobu 2657faae01 * thread.c (thread_timer): pthread_cond_timedwait returns ETIMEDOUT
when timed out.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-06 22:43:30 +00:00
nobu 90c6c35f2e * thread_pthread.c (thread_timer): uses pthread_cond_timedwait always
instead of pthread_kill.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-06 22:12:20 +00:00
nobu 4f3abb93f6 * thread.c (thread_timer): uses timedwait on cygwin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-06 19:02:35 +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
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
nobu 1c22ef1705 * configure.in (shutdown, sched_yield, pthread_attr_setinheritsched):
check for Haiku.

* eval_intern.h, io.c, thread_pthread.c: use autoconfisticated results.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-08 08:03:19 +00:00
naruse 48e21d2051 * eval_intern.h: Add support to Haiku. see [ruby-core:18110]
* include/ruby/defines.h: ditto.

* configure.in: ditto.

* thread_pthread.c: ditto.

* io.c: ditto.

* lib/mkmf.rb: ditto.

* ext/socket/getaddrinfo.c: ditto.

* ext/socket/extconf.rb: ditto.

* ext/socket/socket.c: ditto.

* ext/socket/addrinfo.h: ditto.

* ext/socket/getnameinfo.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-06 20:52:44 +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
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