示例#1
0
文件: signal.c 项目: professor/rhodes
void
rb_signal_exec(rb_thread_t *th, int sig)
{
    rb_vm_t *vm = GET_VM();
    VALUE cmd = vm->trap_list[sig].cmd;
    int safe = vm->trap_list[sig].safe;

    if (cmd == 0) {
	switch (sig) {
	  case SIGINT:
	    rb_interrupt();
	    break;
#ifdef SIGHUP
	  case SIGHUP:
#endif
#ifdef SIGQUIT
	  case SIGQUIT:
#endif
#ifdef SIGTERM
	  case SIGTERM:
#endif
#ifdef SIGALRM
	  case SIGALRM:
#endif
#ifdef SIGUSR1
	  case SIGUSR1:
#endif
#ifdef SIGUSR2
	  case SIGUSR2:
#endif
	    rb_thread_signal_raise(th, sig);
	    break;
	}
    }
    else if (cmd == Qundef) {
	rb_thread_signal_exit(th);
    }
    else {
	signal_exec(cmd, safe, sig);
    }
}
示例#2
0
文件: signal.c 项目: genki/ruby
void
rb_signal_exec(rb_thread_t *th, int sig)
{
    VALUE cmd = rb_get_trap_cmd(sig);

    if (cmd == 0) {
	switch (sig) {
	  case SIGINT:
	    rb_interrupt();
	    break;
#ifdef SIGHUP
	  case SIGHUP:
#endif
#ifdef SIGQUIT
	  case SIGQUIT:
#endif
#ifdef SIGTERM
	  case SIGTERM:
#endif
#ifdef SIGALRM
	  case SIGALRM:
#endif
#ifdef SIGUSR1
	  case SIGUSR1:
#endif
#ifdef SIGUSR2
	  case SIGUSR2:
#endif
	    rb_thread_signal_raise(th, sig);
	    break;
	}
    }
    else if (cmd == Qundef) {
	rb_thread_signal_exit(th);
    }
    else {
	signal_exec(cmd, sig);
    }
}
示例#3
0
void
rb_signal_exec(rb_thread_t *th, int sig)
{
    VALUE cmd = rb_get_trap_cmd(sig);

    if (cmd == 0) {
	switch (sig) {
	  case SIGINT:
	    rb_interrupt();
	    break;
#ifdef SIGHUP
	  case SIGHUP:
#endif
#ifdef SIGQUIT
	  case SIGQUIT:
#endif
#ifdef SIGALRM
	  case SIGALRM:
#endif
#ifdef SIGUSR1
	  case SIGUSR1:
#endif
#ifdef SIGUSR2
	  case SIGUSR2:
#endif
	    rb_thread_signal_raise(th, signo2signm(sig));
	    break;
	}
    }
    else if (cmd == Qundef) {
	rb_thread_signal_exit(th);
    }
    else {
	rb_proc_t *proc;
	VALUE signum = INT2FIX(sig);
	GetProcPtr(cmd, proc);
	th_invoke_proc(th, proc, proc->block.self, 1, &signum);
    }
}