зеркало из https://github.com/github/ruby.git
introduce `rb_ec_check_ints()`
to avoid TLS issue with N:M threads.
This commit is contained in:
Родитель
0d63b9b4a4
Коммит
97aaf6f760
|
@ -66,6 +66,8 @@ struct rb_io_close_wait_list {
|
|||
int rb_notify_fd_close(int fd, struct rb_io_close_wait_list *busy);
|
||||
void rb_notify_fd_close_wait(struct rb_io_close_wait_list *busy);
|
||||
|
||||
void rb_ec_check_ints(struct rb_execution_context_struct *ec);
|
||||
|
||||
RUBY_SYMBOL_EXPORT_BEGIN
|
||||
|
||||
void *rb_thread_prevent_fork(void *(*func)(void *), void *data); /* for ext/socket/raddrinfo.c */
|
||||
|
|
4
ractor.c
4
ractor.c
|
@ -602,7 +602,7 @@ ractor_check_ints(rb_execution_context_t *ec, rb_ractor_t *cr, ractor_sleep_clea
|
|||
enum ruby_tag_type state;
|
||||
EC_PUSH_TAG(ec);
|
||||
if ((state = EC_EXEC_TAG()) == TAG_NONE) {
|
||||
rb_thread_check_ints();
|
||||
rb_ec_check_ints(ec);
|
||||
}
|
||||
EC_POP_TAG();
|
||||
|
||||
|
@ -612,7 +612,7 @@ ractor_check_ints(rb_execution_context_t *ec, rb_ractor_t *cr, ractor_sleep_clea
|
|||
}
|
||||
}
|
||||
else {
|
||||
rb_thread_check_ints();
|
||||
rb_ec_check_ints(ec);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
8
thread.c
8
thread.c
|
@ -1416,6 +1416,12 @@ rb_thread_wait_for(struct timeval time)
|
|||
sleep_hrtime(th, rb_timeval2hrtime(&time), SLEEP_SPURIOUS_CHECK);
|
||||
}
|
||||
|
||||
void
|
||||
rb_ec_check_ints(rb_execution_context_t *ec)
|
||||
{
|
||||
RUBY_VM_CHECK_INTS_BLOCKING(ec);
|
||||
}
|
||||
|
||||
/*
|
||||
* CAUTION: This function causes thread switching.
|
||||
* rb_thread_check_ints() check ruby's interrupts.
|
||||
|
@ -1426,7 +1432,7 @@ rb_thread_wait_for(struct timeval time)
|
|||
void
|
||||
rb_thread_check_ints(void)
|
||||
{
|
||||
RUBY_VM_CHECK_INTS_BLOCKING(GET_EC());
|
||||
rb_ec_check_ints(GET_EC());
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Загрузка…
Ссылка в новой задаче