ruby-changes:25624
From: ko1 <ko1@a...>
Date: Fri, 16 Nov 2012 19:35:05 +0900 (JST)
Subject: [ruby-changes:25624] ko1:r37681 (trunk): * thread.c (rb_thread_call_without_gvl2): change the parameter of
ko1 2012-11-16 19:34:54 +0900 (Fri, 16 Nov 2012) New Revision: 37681 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37681 Log: * thread.c (rb_thread_call_without_gvl2): change the parameter of `func' from `int *skip_interrupt' to `VALUE *flags'. If (flags & RUBY_CALL_WO_GVL_FLAG_SKIP_CHECK_INTS) is not zero, then skip checking interrupt. [ruby-core:46547] * include/ruby/thread.h: ditto. Modified files: trunk/ChangeLog trunk/include/ruby/thread.h trunk/thread.c Index: include/ruby/thread.h =================================================================== --- include/ruby/thread.h (revision 37680) +++ include/ruby/thread.h (revision 37681) @@ -28,9 +28,10 @@ void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1); void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1, rb_unblock_function_t *ubf, void *data2); -void *rb_thread_call_without_gvl2(void *(*func)(void *, int *), void *data1, +void *rb_thread_call_without_gvl2(void *(*func)(void *, VALUE *), void *data1, rb_unblock_function_t *ubf, void *data2); +#define RUBY_CALL_WO_GVL_FLAG_SKIP_CHECK_INTS 0x01 #if defined __GNUC__ && __GNUC__ >= 4 #pragma GCC visibility pop Index: ChangeLog =================================================================== --- ChangeLog (revision 37680) +++ ChangeLog (revision 37681) @@ -1,3 +1,13 @@ +Fri Nov 16 19:24:10 2012 Koichi Sasada <ko1@a...> + + * thread.c (rb_thread_call_without_gvl2): change the parameter of + `func' from `int *skip_interrupt' to `VALUE *flags'. + If (flags & RUBY_CALL_WO_GVL_FLAG_SKIP_CHECK_INTS) is not zero, + then skip checking interrupt. + [ruby-core:46547] + + * include/ruby/thread.h: ditto. + Fri Nov 16 18:59:05 2012 NARUSE, Yui <naruse@r...> * Makefile.in (no-dtrace-probes.h): dmyprobes.h is in srcdir. Index: thread.c =================================================================== --- thread.c (revision 37680) +++ thread.c (revision 37681) @@ -1094,9 +1094,9 @@ * * rb_thread_call_without_gvl2() does: * (1) release GVL. - * (2) call func with data1 and a pointer to the skip_interrupt flag. + * (2) call func with data1 and a pointer to the flags. * (3) acquire GVL. - * (4) Check interrupts if skip_interrupt flag is not set. + * (4) Check interrupts if (flags & RUBY_CALL_WO_GVL_FLAG_SKIP_CHECK_INTS) is 0. * * If another thread interrupts this thread (Thread#kill, signal delivery, * VM-shutdown request, and so on), `ubf()' is called (`ubf()' means @@ -1133,12 +1133,12 @@ * because it causes irrevocable side-effect, the read data will vanish. To * avoid such problem, the `read_func()' should be: * - * read_func(void *data, int *skip_check_flag) { + * read_func(void *data, VALUE *flags) { * // (a) before read * read(buffer); // (b) reading * // (c) after read * if (read is complete) { - * *skip_check_flag = 1; + * *flags |= RUBY_CALL_WO_GVL_FLAG_SKIP_CHECK_INTS; * } * } * @@ -1164,13 +1164,13 @@ * they will work without GVL, and may acquire GVL when GC is needed. */ void * -rb_thread_call_without_gvl2(void *(*func)(void *data, int *skip_checkints), void *data1, +rb_thread_call_without_gvl2(void *(*func)(void *data, VALUE *flags), void *data1, rb_unblock_function_t *ubf, void *data2) { void *val; rb_thread_t *th = GET_THREAD(); int saved_errno = 0; - int skip_checkints = 0; + VALUE flags = 0; th->waiting_fd = -1; if (ubf == RUBY_UBF_IO || ubf == RUBY_UBF_PROCESS) { @@ -1179,11 +1179,11 @@ } BLOCKING_REGION({ - val = func(data1, &skip_checkints); + val = func(data1, &flags); saved_errno = errno; }, ubf, data2); - if (!skip_checkints) { + if ((flags & RUBY_CALL_WO_GVL_FLAG_SKIP_CHECK_INTS) == 0) { RUBY_VM_CHECK_INTS_BLOCKING(th); } @@ -1198,7 +1198,7 @@ }; static void * -without_gvl_wrapper(void *data, int *skip_checkints) +without_gvl_wrapper(void *data, VALUE *flags) { struct without_gvl_wrapper_arg *arg = (struct without_gvl_wrapper_arg*)data; return arg->func(arg->data); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/