diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-10 13:57:11 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-10 13:57:11 +0000 |
commit | c51a826764c3307a7fe9258e1d18ddca93cb7b5f (patch) | |
tree | b6139e61fe139e418a606ff611b0b6c30ce30dfe /thread.c | |
parent | 1a853390ee08af1b8ff3d1882a8762155d151306 (diff) |
rb_thread_call_without_gvl
* include/ruby/thread.h: new header file for thread stuff.
* thread.c (rb_thread_call_without_gvl): export. [Feature#4328]
returns void* instead of VALUE. [Feature #5543]
* thread.c (rb_thread_blocking_region): deprecate. [ruby-core:46295]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -48,6 +48,7 @@ #include "gc.h" #include "internal.h" #include "ruby/io.h" +#include "ruby/thread.h" #ifndef USE_NATIVE_THREAD_PRIORITY #define USE_NATIVE_THREAD_PRIORITY 0 @@ -1114,12 +1115,11 @@ rb_thread_blocking_region_end(struct rb_blocking_region_buffer *region) * they will work without GVL, and may acquire GVL * when GC is needed. */ -VALUE -rb_thread_blocking_region( - rb_blocking_function_t *func, void *data1, - rb_unblock_function_t *ubf, void *data2) +void * +rb_thread_call_without_gvl(void *(*func)(void *), void *data1, + rb_unblock_function_t *ubf, void *data2) { - VALUE val; + void *val; rb_thread_t *th = GET_THREAD(); int saved_errno = 0; @@ -1156,14 +1156,13 @@ rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd) return val; } -/* alias of rb_thread_blocking_region() */ - VALUE -rb_thread_call_without_gvl( +rb_thread_blocking_region( rb_blocking_function_t *func, void *data1, rb_unblock_function_t *ubf, void *data2) { - return rb_thread_blocking_region(func, data1, ubf, data2); + void *(*f)(void*) = (void *(*)(void*))func; + return (VALUE)rb_thread_call_without_gvl(f, data1, ubf, data2); } /* |