summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--thread_native.h2
-rw-r--r--thread_pthread.c6
-rw-r--r--thread_win32.c7
4 files changed, 22 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 611199bc97..c68b0838b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Jul 23 19:44:32 2013 Koichi Sasada <ko1@atdot.net>
+
+ * thread_native.h: add rb_nativethread_self() which returns
+ current running native thread identifier.
+
+ * thread_[pthread|win32].c: implement rb_nativethread_self().
+
Tue Jul 23 19:34:11 2013 Koichi Sasada <ko1@atdot.net>
* thread_pthread.h, thread_win32.h: rename rb_thread_id_t to
diff --git a/thread_native.h b/thread_native.h
index 2870b895c6..aa037d205f 100644
--- a/thread_native.h
+++ b/thread_native.h
@@ -11,6 +11,8 @@
RUBY_SYMBOL_EXPORT_BEGIN
+rb_nativethread_id_t rb_nativethread_self();
+
void rb_nativethread_lock_initialize(rb_nativethread_lock_t *lock);
void rb_nativethread_lock_destroy(rb_nativethread_lock_t *lock);
void rb_nativethread_lock_lock(rb_nativethread_lock_t *lock);
diff --git a/thread_pthread.c b/thread_pthread.c
index e13e26786e..1b4ec10b98 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1535,4 +1535,10 @@ rb_reserved_fd_p(int fd)
#endif
}
+rb_nativethread_id_t
+rb_nativethread_self(void)
+{
+ return pthread_self();
+}
+
#endif /* THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION */
diff --git a/thread_win32.c b/thread_win32.c
index b484fece8e..250b2b7b80 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -766,4 +766,11 @@ rb_reserved_fd_p(int fd)
{
return 0;
}
+
+rb_nativethread_id_t
+rb_nativethread_self(void)
+{
+ return GetCurrentThread();
+}
+
#endif /* THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION */