* thread.c (GVL_UNLOCK_RANGE): rename to BLOCKING_REGION().

* thread.c (rb_thread_run_parallel): rename to
  rb_thread_blocking_region().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2007-02-08 12:06:08 +00:00
parent ae317b518c
commit eb64061a38
2 changed files with 16 additions and 10 deletions

View File

@ -1,3 +1,10 @@
Thu Feb 8 21:02:07 2007 Koichi Sasada <ko1@atdot.net>
* thread.c (GVL_UNLOCK_RANGE): rename to BLOCKING_REGION().
* thread.c (rb_thread_run_parallel): rename to
rb_thread_blocking_region().
Thu Feb 8 15:48:44 2007 Koichi Sasada <ko1@atdot.net> Thu Feb 8 15:48:44 2007 Koichi Sasada <ko1@atdot.net>
* yarvcore.h, thread.c: fix to use pthread on cygwin. * yarvcore.h, thread.c: fix to use pthread on cygwin.

View File

@ -92,7 +92,7 @@ NOINLINE(void rb_gc_save_machine_context(rb_thread_t *));
rb_thread_set_current(_th_stored); \ rb_thread_set_current(_th_stored); \
} while(0) } while(0)
#define GVL_UNLOCK_RANGE(exec, ubf) do { \ #define BLOCKING_REGION(exec, ubf) do { \
rb_thread_t *__th = GET_THREAD(); \ rb_thread_t *__th = GET_THREAD(); \
int __prev_status = __th->status; \ int __prev_status = __th->status; \
set_unblock_function(__th, ubf, 0); \ set_unblock_function(__th, ubf, 0); \
@ -596,22 +596,21 @@ rb_thread_s_critical(VALUE self)
return Qnil; return Qnil;
} }
VALUE VALUE
rb_thread_run_parallel(VALUE(*func)(rb_thread_t *th, void *), void *data, rb_thread_blocking_region(
VALUE(*func)(rb_thread_t *th, void *), void *data,
rb_unblock_function_t *ubf) rb_unblock_function_t *ubf)
{ {
VALUE val; VALUE val;
rb_thread_t *th = GET_THREAD(); rb_thread_t *th = GET_THREAD();
GVL_UNLOCK_RANGE({ BLOCKING_REGION({
val = func(th, data); val = func(th, data);
}, ubf); }, ubf);
return val; return val;
} }
/* /*
* call-seq: * call-seq:
* Thread.pass => nil * Thread.pass => nil
@ -1661,7 +1660,7 @@ do_select(int n, fd_set *read, fd_set *write, fd_set *except,
if (write) orig_write = *write; if (write) orig_write = *write;
if (except) orig_except = *except; if (except) orig_except = *except;
GVL_UNLOCK_RANGE({ BLOCKING_REGION({
result = select(n, read, write, except, wait); result = select(n, read, write, except, wait);
if (result < 0) lerrno = errno; if (result < 0) lerrno = errno;
}, 0); }, 0);
@ -1673,7 +1672,7 @@ do_select(int n, fd_set *read, fd_set *write, fd_set *except,
wait = &wait_100ms; wait = &wait_100ms;
} while (timeout == 0 || subst(timeout, &wait_100ms)); } while (timeout == 0 || subst(timeout, &wait_100ms));
#else #else
GVL_UNLOCK_RANGE({ BLOCKING_REGION({
result = select(n, read, write, except, timeout); result = select(n, read, write, except, timeout);
if (result < 0) lerrno = errno; if (result < 0) lerrno = errno;
}, ubf_select); }, ubf_select);