ruby-changes:30085
From: ko1 <ko1@a...>
Date: Tue, 23 Jul 2013 19:46:49 +0900 (JST)
Subject: [ruby-changes:30085] ko1:r42137 (trunk): * thread_native.h: add rb_nativethread_self() which returns
ko1 2013-07-23 19:46:37 +0900 (Tue, 23 Jul 2013) New Revision: 42137 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42137 Log: * thread_native.h: add rb_nativethread_self() which returns current running native thread identifier. * thread_[pthread|win32].c: implement rb_nativethread_self(). Modified files: trunk/ChangeLog trunk/thread_native.h trunk/thread_pthread.c trunk/thread_win32.c Index: thread_win32.c =================================================================== --- thread_win32.c (revision 42136) +++ thread_win32.c (revision 42137) @@ -766,4 +766,11 @@ rb_reserved_fd_p(int fd) https://github.com/ruby/ruby/blob/trunk/thread_win32.c#L766 { return 0; } + +rb_nativethread_id_t +rb_nativethread_self(void) +{ + return GetCurrentThread(); +} + #endif /* THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION */ Index: ChangeLog =================================================================== --- ChangeLog (revision 42136) +++ ChangeLog (revision 42137) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Jul 23 19:44:32 2013 Koichi Sasada <ko1@a...> + + * 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@a...> * thread_pthread.h, thread_win32.h: rename rb_thread_id_t to Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 42136) +++ thread_pthread.c (revision 42137) @@ -1535,4 +1535,10 @@ rb_reserved_fd_p(int fd) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1535 #endif } +rb_nativethread_id_t +rb_nativethread_self(void) +{ + return pthread_self(); +} + #endif /* THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION */ Index: thread_native.h =================================================================== --- thread_native.h (revision 42136) +++ thread_native.h (revision 42137) @@ -11,6 +11,8 @@ https://github.com/ruby/ruby/blob/trunk/thread_native.h#L11 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/