summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-02 03:58:25 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-02 03:58:25 +0000
commit1927b35e4c52f8f6d1255b89c4b98df9cfcbbebb (patch)
tree42ad406ac6ac2b5063425f41be3fb2095c90c6f0
parent669e0f35d3ba6af1091bde73fca83ac522abc93b (diff)
downloadruby-1927b35e4c52f8f6d1255b89c4b98df9cfcbbebb.tar.gz
ruby-1927b35e4c52f8f6d1255b89c4b98df9cfcbbebb.tar.xz
ruby-1927b35e4c52f8f6d1255b89c4b98df9cfcbbebb.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@25627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog10
-rw-r--r--thread.c5
-rw-r--r--thread_pthread.c7
-rw-r--r--thread_win32.c11
4 files changed, 30 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f2b25a363..1e75ed02e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Mon Nov 2 12:55:50 2009 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * 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.
+
Mon Nov 2 11:22:19 2009 NARUSE, Yui <naruse@ruby-lang.org>
* ext/dl/win32/lib/win32/registry.rb: update rdoc. [ruby-core:26022]
diff --git a/thread.c b/thread.c
index 32e54996b..0b99c007c 100644
--- a/thread.c
+++ b/thread.c
@@ -2651,15 +2651,14 @@ void
rb_thread_stop_timer_thread(void)
{
if (timer_thread_id && native_stop_timer_thread()) {
- native_thread_join(timer_thread_id);
- timer_thread_id = 0;
+ native_reset_timer_thread();
}
}
void
rb_thread_reset_timer_thread(void)
{
- timer_thread_id = 0;
+ native_reset_timer_thread();
}
void
diff --git a/thread_pthread.c b/thread_pthread.c
index a4e7f25d7..e3ff6ee71 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -816,9 +816,16 @@ native_stop_timer_thread(void)
native_cond_signal(&timer_thread_cond);
}
native_mutex_unlock(&timer_thread_lock);
+ native_thread_join(timer_thread_id);
return stopped;
}
+static void
+native_reset_timer_thread(void)
+{
+ timer_thread_id = 0;
+}
+
#ifdef HAVE_SIGALTSTACK
int
ruby_stack_overflowed_p(const rb_thread_t *th, const void *addr)
diff --git a/thread_win32.c b/thread_win32.c
index f404a4f31..139b94a94 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -564,10 +564,21 @@ native_stop_timer_thread(void)
{
int stopped = --system_working <= 0;
if (stopped) {
+ SetEvent(timer_thread_lock);
+ native_thread_join(timer_thread_id);
CloseHandle(timer_thread_lock);
timer_thread_lock = 0;
}
return stopped;
}
+static void
+native_reset_timer_thread(void)
+{
+ if (timer_thread_id) {
+ CloseHandle(timer_thread_id);
+ timer_thread_id = 0;
+ }
+}
+
#endif /* THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION */