summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-10 13:57:11 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-10 13:57:11 +0000
commitc51a826764c3307a7fe9258e1d18ddca93cb7b5f (patch)
treeb6139e61fe139e418a606ff611b0b6c30ce30dfe /thread.c
parent1a853390ee08af1b8ff3d1882a8762155d151306 (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.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/thread.c b/thread.c
index 7de1dcaf82..2a40069b91 100644
--- a/thread.c
+++ b/thread.c
@@ -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);
}
/*