From 84f8da11579b8b655505dc8abffc31c715784794 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 7 Jan 2007 09:47:52 +0000 Subject: * thread.c (rb_thread_stop_timer_thread(), rb_thread_reset_timer_thread(), rb_thread_start_timer_thread()): added. * thread_pthread.ci: add a native_thread_join() and move rb_thread_reset_timer_thread() definition to thread.c. * thread_win32.ci: ditto * process.c: fix before_exec(), after_exec() to stop timer thread (and restart timer thread if exec failed). and fix to reset timer thread information when forked child process starts (to fix [ruby-core:09822]). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- process.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'process.c') diff --git a/process.c b/process.c index 69002fabde..25f62a6327 100644 --- a/process.c +++ b/process.c @@ -891,8 +891,10 @@ proc_detach(VALUE obj, VALUE pid) char *strtok(); #endif -#define before_exec() rb_enable_interrupt() -#define after_exec() rb_disable_interrupt() +#define before_exec() \ + (rb_enable_interrupt(), rb_thread_stop_timer_thread()) +#define after_exec() \ + (rb_thread_start_timer_thread(), rb_disable_interrupt()) extern char *dln_find_exe(const char *fname, const char *path); @@ -1332,6 +1334,7 @@ rb_fork(int *status, int (*chfunc)(void*), void *charg) } } if (!pid) { + rb_thread_reset_timer_thread(); if (chfunc) { #ifdef FD_CLOEXEC close(ep[0]); @@ -1347,7 +1350,7 @@ rb_fork(int *status, int (*chfunc)(void*), void *charg) _exit(127); #endif } - rb_thread_reset_timer_thread(); + rb_thread_start_timer_thread(); } #ifdef FD_CLOEXEC else if (chfunc) { -- cgit v1.2.3