Branch: Tag:

2014-05-25

2014-05-25 11:40:41 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Threads: Added inhibition of thread signals.

Some code really doesn't like getting errors thrown (cf code
that uses fatal_on_error()), so add a simple way of delaying
such errors until the critical section is done.

Also makes sure that the thread interrupt signal doesn't get lost.

2748:   static void check_thread_interrupt(struct callback *foo,    void *UNUSED(bar), void *UNUSED(gazonk))   { +  if (Pike_interpreter.thread_state->flags & THREAD_FLAG_INHIBIT) { +  return; +  }    if (Pike_interpreter.thread_state->flags & THREAD_FLAG_SIGNAL_MASK) {    if (Pike_interpreter.thread_state->flags & THREAD_FLAG_TERM) {    throw_severity = THROW_THREAD_EXIT;
2786:    pop_n_elems(args);       if (!(THIS_THREAD->flags & THREAD_FLAG_SIGNAL_MASK)) { -  THIS_THREAD->flags |= THREAD_FLAG_INTR; +     num_pending_interrupts++;    if (!thread_interrupt_callback) {    thread_interrupt_callback =
2794:    }    /* FIXME: Actually interrupt the thread. */    } +  THIS_THREAD->flags |= THREAD_FLAG_INTR;    push_int(0);   }