Project

General

Profile

Bug #4027 » sigmask.patch

nagachika (Tomoyuki Chikanaga), 11/11/2010 01:33 AM

View differences:

eval_intern.h (working copy)
void rb_thread_terminate_all(void);
VALUE rb_vm_top_self();
VALUE rb_vm_cbase(void);
void rb_trap_restore_mask(void);
#ifndef CharNext /* defined as CharNext[AW] on Windows. */
#define CharNext(p) ((p) + mblen(p, RUBY_MBCHAR_MAXSIZE))
vm_eval.c (working copy)
VALUE desc = rb_inspect(tag);
rb_raise(rb_eArgError, "uncaught throw %s", RSTRING_PTR(desc));
}
rb_trap_restore_mask();
th->errinfo = NEW_THROW_OBJECT(tag, 0, TAG_THROW);
JUMP_TAG(TAG_THROW);
eval.c (working copy)
JUMP_TAG(TAG_FATAL);
}
rb_trap_restore_mask();
if (tag != TAG_FATAL) {
EXEC_EVENT_HOOK(th, RUBY_EVENT_RAISE, th->cfp->self, 0, 0);
}
signal.c (working copy)
return signal_buff.size;
}
#if USE_TRAP_MASK
# ifdef HAVE_SIGPROCMASK
static sigset_t trap_last_mask;
# else
static int trap_last_mask;
# endif
#endif
#if HAVE_PTHREAD_H
#include <pthread.h>
#endif
......
vm->trap_list[sig].cmd = command;
vm->trap_list[sig].safe = rb_safe_level();
/* enable at least specified signal. */
#if USE_TRAP_MASK
#ifdef HAVE_SIGPROCMASK
sigdelset(&arg->mask, sig);
#else
arg->mask &= ~sigmask(sig);
#endif
#endif
return oldcmd;
}
......
{
/* enable interrupt */
pthread_sigmask(SIG_SETMASK, &arg->mask, NULL);
trap_last_mask = arg->mask;
return 0;
}
#endif
void
rb_trap_restore_mask(void)
{
#if USE_TRAP_MASK
pthread_sigmask(SIG_SETMASK, &trap_last_mask, NULL);
#endif
}
/*
* call-seq:
* Signal.trap( signal, command ) -> obj
......
} else {
GET_VM()->trap_list[sig].cmd = 0;
}
#if USE_TRAP_MASK
sigdelset(&mask, sig);
pthread_sigmask(SIG_SETMASK, &mask, NULL);
trap_last_mask = mask;
#endif
}
#endif
(2-2/2)