1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

signal to main_thread

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 1998-04-13 06:06:12 +00:00
parent 4af06a86de
commit d453b1a042
6 changed files with 57 additions and 3 deletions

View file

@ -1,3 +1,19 @@
Mon Apr 13 13:18:32 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* eval.c (thread_trap_eval): all handlers executed under main_thread.
Mon Apr 13 12:47:03 1998 TAKAHASHI Masayoshi <maki@inac.co.jp>
* re.c (kcode_set_option): did not SJIS on SJIS condition.
Sun Apr 12 22:14:07 1998 Kazunori NISHI <kazunori@swlab.csce.kyushu-u.ac.jp>
* array.c (ary_uniq_bang): should be `==', not `='. embarrassing.
Fri Apr 10 21:29:06 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
* array.c (ary_subseq): add check for beg larger than array length.
Wed Apr 8 17:24:11 1998 MAEDA shugo <shugo@po.aianet.ne.jp>
* dir.c (dir_s_open): can be called with block (like IO#open).

View file

@ -306,6 +306,9 @@ ary_subseq(ary, beg, len)
beg = RARRAY(ary)->len + beg;
if (beg < 0) beg = 0;
}
if (beg >= RARRAY(ary)->len) {
IndexError("out of range %d", beg);
}
if (len < 0) {
IndexError("negative length %d", RARRAY(ary)->len);
}
@ -1164,7 +1167,7 @@ ary_uniq_bang(ary)
}
end = t;
}
if (RARRAY(ary)->len = (end - RARRAY(ary)->ptr)) {
if (RARRAY(ary)->len == (end - RARRAY(ary)->ptr)) {
return Qnil;
}

28
eval.c
View file

@ -5386,6 +5386,8 @@ static int th_raise_argc;
static VALUE th_raise_argv[2];
static char *th_raise_file;
static int th_raise_line;
static VALUE th_cmd;
static int th_sig;
static void
thread_restore_context(th, exit)
@ -5442,6 +5444,10 @@ thread_restore_context(th, exit)
break;
case 3:
rb_trap_eval(th_cmd, th_sig);
break;
case 4:
the_frame->last_func = 0;
sourcefile = th_raise_file;
sourceline = th_raise_line;
@ -6244,6 +6250,26 @@ thread_interrupt()
thread_restore_context(curr_thread, 2);
}
void
thread_trap_eval(cmd, sig)
VALUE cmd;
int sig;
{
thread_critical = 0;
thread_ready(main_thread);
if (curr_thread == main_thread) {
rb_trap_eval(cmd, sig);
}
thread_save_context(curr_thread);
if (setjmp(curr_thread->context)) {
return;
}
th_cmd = cmd;
th_sig = sig;
curr_thread = main_thread;
thread_restore_context(curr_thread, 3);
}
static VALUE
thread_raise(argc, argv, thread)
int argc;
@ -6269,7 +6295,7 @@ thread_raise(argc, argv, thread)
th_raise_argc = argc;
th_raise_file = sourcefile;
th_raise_line = sourceline;
thread_restore_context(curr_thread, 3);
thread_restore_context(curr_thread, 4);
return Qnil; /* not reached */
}

View file

@ -135,6 +135,7 @@ void thread_sleep _((int));
void thread_sleep_forever _((void));
VALUE thread_create _((VALUE (*)(), void *));
void thread_interrupt _((void));
void thread_trap_eval _((VALUE, int));
/* file.c */
VALUE file_open _((char *, char *));
int eaccess _((char *, int));

6
re.c
View file

@ -147,7 +147,7 @@ kcode_set_option(reg)
mbcinit(MBCTYPE_EUC);
break;
case KCODE_SJIS:
mbcinit(MBCTYPE_EUC);
mbcinit(MBCTYPE_SJIS);
break;
}
}
@ -883,6 +883,10 @@ reg_regsub(str, src, regs)
char *ss = s;
c = *s++;
if (ismbchar(c)) {
s++;
continue;
}
if (c != '\\' || s == e) continue;
if (!val) val = str_new(p, ss-p);

View file

@ -341,7 +341,11 @@ rb_trap_exec()
#endif
return;
}
#ifdef THREAD
thread_trap_eval(trap_list[i], i);
#else
rb_trap_eval(trap_list[i], i);
#endif
}
}
trap_pending = 0;