mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
9895ce9f77
commit
da06c63c66
2 changed files with 9 additions and 10 deletions
|
@ -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>
|
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
|
* 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
|
#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);
|
static void clear_unblock_function(rb_thread_t *th);
|
||||||
|
|
||||||
NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p));
|
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 { \
|
#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); \
|
||||||
__th->status = THREAD_STOPPED; \
|
__th->status = THREAD_STOPPED; \
|
||||||
GVL_UNLOCK_BEGIN(); {\
|
GVL_UNLOCK_BEGIN(); {\
|
||||||
exec; \
|
exec; \
|
||||||
|
@ -160,20 +160,15 @@ thread_debug(const char *fmt, ...)
|
||||||
|
|
||||||
|
|
||||||
static void
|
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:
|
check_ints:
|
||||||
RUBY_VM_CHECK_INTS();
|
RUBY_VM_CHECK_INTS(); /* check signal or so */
|
||||||
native_mutex_lock(&th->interrupt_lock);
|
native_mutex_lock(&th->interrupt_lock);
|
||||||
if (th->interrupt_flag) {
|
if (th->interrupt_flag) {
|
||||||
native_mutex_unlock(&th->interrupt_lock);
|
native_mutex_unlock(&th->interrupt_lock);
|
||||||
if (is_return) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
goto check_ints;
|
goto check_ints;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
th->unblock_function = func;
|
th->unblock_function = func;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +188,6 @@ rb_thread_interrupt(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
native_mutex_lock(&th->interrupt_lock);
|
native_mutex_lock(&th->interrupt_lock);
|
||||||
th->interrupt_flag = 1;
|
th->interrupt_flag = 1;
|
||||||
|
|
||||||
if (th->unblock_function) {
|
if (th->unblock_function) {
|
||||||
(th->unblock_function)(th);
|
(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)));
|
GET_THROWOBJ_STATE(err), GET_THROWOBJ_VAL(err)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
/* normal exception */
|
||||||
rb_exc_raise(err);
|
rb_exc_raise(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue