예제 #1
0
static void
rb_signal_exec(int sig)
{
/*     rb_vm_thread_t *t; */
/*     VALUE exc; */
    VALUE cmd = rb_get_trap_cmd(sig);

    if (cmd == 0) {
	switch (sig) {
	  case SIGINT:
	    rb_interrupt();
	    break;
	  case SIGHUP:
	  case SIGQUIT:
	  case SIGTERM:
	  case SIGALRM:
	  case SIGUSR1:
	  case SIGUSR2:
/* 	    t = GetThreadPtr(rb_vm_main_thread()); */
/* 	    exc = rb_exc_new2(rb_eSignal, ruby_signal_name(sig)); */
/* 	    rb_vm_thread_raise(t, exc); */
/* 	    rb_raise(rb_eSignal, "%s", signo2signm(sig)); */
	    break;
	}
    }
    else if (cmd == Qundef) {
	//rb_thread_signal_exit(th);
    }
    else {
	signal_exec(cmd, rb_vm_trap_level_for_signal(sig), sig);
    }
}
예제 #2
0
파일: signal.c 프로젝트: yugui/ruby
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_threadptr_signal_raise(th, sig);
	    break;
	}
    }
    else if (cmd == Qundef) {
	rb_threadptr_signal_exit(th);
    }
    else {
	signal_exec(cmd, safe, sig);
    }
}
예제 #3
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);
    }
}
예제 #4
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);
    }
}