mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* thread.c (rb_thread_execute_interrupts): if signal is already
buffered, main thread should wait until timer thread delivers it. * thread.c (timer_thread_function): should defer delivery of a signal if main thread does not yet trap a previous one. [ruby-dev:37676] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
de0297f596
commit
3e7c34140c
2 changed files with 15 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Fri Jan 16 02:25:46 2009 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
|
* thread.c (rb_thread_execute_interrupts): if signal is already
|
||||||
|
buffered, main thread should wait until timer thread delivers it.
|
||||||
|
|
||||||
|
* thread.c (timer_thread_function): should defer delivery of a signal
|
||||||
|
if main thread does not yet trap a previous one. [ruby-dev:37676]
|
||||||
|
|
||||||
Fri Jan 16 02:05:55 2009 Tanaka Akira <akr@fsij.org>
|
Fri Jan 16 02:05:55 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/socket/socket.c (addrinfo_s_ip): new method AddrInfo.ip.
|
* ext/socket/socket.c (addrinfo_s_ip): new method AddrInfo.ip.
|
||||||
|
|
9
thread.c
9
thread.c
|
@ -1179,6 +1179,10 @@ thread_s_pass(VALUE klass)
|
||||||
void
|
void
|
||||||
rb_thread_execute_interrupts(rb_thread_t *th)
|
rb_thread_execute_interrupts(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
|
if (GET_VM()->main_thread == th) {
|
||||||
|
while (rb_signal_buff_size() && !th->exec_signal) native_thread_yield();
|
||||||
|
}
|
||||||
|
|
||||||
if (th->raised_flag) return;
|
if (th->raised_flag) return;
|
||||||
|
|
||||||
while (th->interrupt_flag) {
|
while (th->interrupt_flag) {
|
||||||
|
@ -2518,13 +2522,14 @@ timer_thread_function(void *arg)
|
||||||
{
|
{
|
||||||
rb_vm_t *vm = GET_VM(); /* TODO: fix me for Multi-VM */
|
rb_vm_t *vm = GET_VM(); /* TODO: fix me for Multi-VM */
|
||||||
int sig;
|
int sig;
|
||||||
|
rb_thread_t *mth;
|
||||||
|
|
||||||
/* for time slice */
|
/* for time slice */
|
||||||
RUBY_VM_SET_TIMER_INTERRUPT(vm->running_thread);
|
RUBY_VM_SET_TIMER_INTERRUPT(vm->running_thread);
|
||||||
|
|
||||||
/* check signal */
|
/* check signal */
|
||||||
if ((sig = rb_get_next_signal()) > 0) {
|
mth = vm->main_thread;
|
||||||
rb_thread_t *mth = vm->main_thread;
|
if (!mth->exec_signal && (sig = rb_get_next_signal()) > 0) {
|
||||||
enum rb_thread_status prev_status = mth->status;
|
enum rb_thread_status prev_status = mth->status;
|
||||||
thread_debug("main_thread: %s, sig: %d\n",
|
thread_debug("main_thread: %s, sig: %d\n",
|
||||||
thread_status_name(prev_status), sig);
|
thread_status_name(prev_status), sig);
|
||||||
|
|
Loading…
Add table
Reference in a new issue