summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-04-19 17:37:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-04-19 17:37:03 +0000
commit3fc37d71c4a1a25c3a77464c614595703d63c2e6 (patch)
treed5df9db3b8de33463cf782336d1e3edd240dde73 /thread.c
parenta73894337a830cdd32a913964f3150bc35269975 (diff)
* eval.c (ruby_cleanup): re-send signal. [ruby-dev:30516]
* eval_error.h (error_handle): no message when exiting by signal. * intern.h (rb_thread_signal_raise, ruby_default_signal): prototypes. * signal.c (esignal_init): takes a signal number and an optional signal name. * signal.c (interrupt_init): pass SIGINT always. * signal.c (ruby_default_signal): invoke system default signal handler. * signal.c (rb_f_kill): use NUM2PIDT instead of NUM2INT. * signal.c (rb_signal_exec, trap): handle SIGTERM. [ruby-dev:30505] * thread.c (rb_thread_signal_raise): now takes signal number instead of signal name. * thread.c (rb_thread_signal_exit): since rb_make_exception() calls #exception method, rb_class_new_instance() is not needed here. * yarvcore.h (struct rb_vm_struct), eval_jump.h (terminate_process): exit_code is no longer stored in VM. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/thread.c b/thread.c
index 05f4840072..4c1fea3174 100644
--- a/thread.c
+++ b/thread.c
@@ -751,31 +751,25 @@ rb_thread_raise(int argc, VALUE *argv, rb_thread_t *th)
}
void
-rb_thread_signal_raise(void *thptr, const char *sig)
+rb_thread_signal_raise(void *thptr, int sig)
{
- VALUE argv[1];
- char buf[BUFSIZ];
+ VALUE argv[2];
rb_thread_t *th = thptr;
-
- if (sig == 0) {
- return; /* should not happen */
- }
- snprintf(buf, BUFSIZ, "SIG%s", sig);
- argv[0] = rb_exc_new3(rb_eSignal, rb_str_new2(buf));
- rb_thread_raise(1, argv, th->vm->main_thread);
+
+ argv[0] = rb_eSignal;
+ argv[1] = INT2FIX(sig);
+ rb_thread_raise(2, argv, th->vm->main_thread);
}
void
rb_thread_signal_exit(void *thptr)
{
- VALUE argv[1];
- VALUE args[2];
+ VALUE argv[2];
rb_thread_t *th = thptr;
-
- args[0] = INT2NUM(EXIT_SUCCESS);
- args[1] = rb_str_new2("exit");
- argv[0] = rb_class_new_instance(2, args, rb_eSystemExit);
- rb_thread_raise(1, argv, th->vm->main_thread);
+
+ argv[0] = rb_eSystemExit;
+ argv[1] = rb_str_new2("exit");
+ rb_thread_raise(2, argv, th->vm->main_thread);
}
int