зеркало из https://github.com/github/ruby.git
* thread.c (set_unblock_function): fix function interface.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
9895ce9f77
Коммит
da06c63c66
|
@ -1,3 +1,7 @@
|
|||
Wed Feb 14 11:39:18 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* thread.c (set_unblock_function): fix function interface.
|
||||
|
||||
Wed Feb 14 11:12:02 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* eval_load.c, yarvcore.h: use rb_vm_t#loaded_features instead of
|
||||
|
|
15
thread.c
15
thread.c
|
@ -76,7 +76,7 @@ st_delete_wrap(st_table * table, VALUE key)
|
|||
|
||||
#define THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION
|
||||
|
||||
static void set_unblock_function(rb_thread_t *th, rb_unblock_function_t *func, int is_return);
|
||||
static void set_unblock_function(rb_thread_t *th, rb_unblock_function_t *func);
|
||||
static void clear_unblock_function(rb_thread_t *th);
|
||||
|
||||
NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p));
|
||||
|
@ -95,7 +95,7 @@ NOINLINE(void rb_gc_save_machine_context(rb_thread_t *));
|
|||
#define BLOCKING_REGION(exec, ubf) do { \
|
||||
rb_thread_t *__th = GET_THREAD(); \
|
||||
int __prev_status = __th->status; \
|
||||
set_unblock_function(__th, ubf, 0); \
|
||||
set_unblock_function(__th, ubf); \
|
||||
__th->status = THREAD_STOPPED; \
|
||||
GVL_UNLOCK_BEGIN(); {\
|
||||
exec; \
|
||||
|
@ -160,20 +160,15 @@ thread_debug(const char *fmt, ...)
|
|||
|
||||
|
||||
static void
|
||||
set_unblock_function(rb_thread_t *th, rb_unblock_function_t *func, int is_return)
|
||||
set_unblock_function(rb_thread_t *th, rb_unblock_function_t *func)
|
||||
{
|
||||
check_ints:
|
||||
RUBY_VM_CHECK_INTS();
|
||||
RUBY_VM_CHECK_INTS(); /* check signal or so */
|
||||
native_mutex_lock(&th->interrupt_lock);
|
||||
if (th->interrupt_flag) {
|
||||
native_mutex_unlock(&th->interrupt_lock);
|
||||
if (is_return) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
goto check_ints;
|
||||
}
|
||||
}
|
||||
else {
|
||||
th->unblock_function = func;
|
||||
}
|
||||
|
@ -193,7 +188,6 @@ rb_thread_interrupt(rb_thread_t *th)
|
|||
{
|
||||
native_mutex_lock(&th->interrupt_lock);
|
||||
th->interrupt_flag = 1;
|
||||
|
||||
if (th->unblock_function) {
|
||||
(th->unblock_function)(th);
|
||||
}
|
||||
|
@ -398,6 +392,7 @@ thread_join(rb_thread_t *target_th, double delay)
|
|||
GET_THROWOBJ_STATE(err), GET_THROWOBJ_VAL(err)));
|
||||
}
|
||||
else {
|
||||
/* normal exception */
|
||||
rb_exc_raise(err);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче