1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-10-11 06:29:16 +00:00
parent a86f6a00df
commit 6c11709d4c
6 changed files with 47 additions and 19 deletions

View file

@ -4,6 +4,17 @@ Wed Oct 11 14:29:51 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
* lib/net/http.rb: code refining.
Wed Oct 11 11:13:03 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (primary): setter method (e.g. foo=) should always be
public.
* eval.c (rb_thread_raise): should not raise SecurityError if
exception raised by the interpreter.
* eval.c (rb_thread_cleanup): skip all THREAD_KILLED threads
before FOREACH_THREAD.
Tue Oct 10 16:11:54 2000 WATANABE Hirofumi <eban@ruby-lang.org>
* dln.c (dln_load): remove unused code for cygwin.

35
eval.c
View file

@ -7723,7 +7723,7 @@ catch_timer(sig)
int rb_thread_tick = THREAD_TICK;
#endif
static VALUE rb_thread_raise _((int, VALUE*, VALUE));
static VALUE rb_thread_raise _((int, VALUE*, rb_thread_t));
#define SCOPE_SHARED FL_USER1
@ -7806,13 +7806,13 @@ rb_thread_start_0(fn, arg, th)
}
else if (rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
/* delegate exception to main_thread */
rb_thread_raise(1, &ruby_errinfo, main_thread->thread);
rb_thread_raise(1, &ruby_errinfo, main_thread);
}
else if (thread_abort || th->abort || RTEST(ruby_debug)) {
VALUE err = rb_exc_new(rb_eSystemExit, 0, 0);
error_print();
/* exit on main_thread */
rb_thread_raise(1, &err, main_thread->thread);
rb_thread_raise(1, &err, main_thread);
}
else {
th->errinfo = ruby_errinfo;
@ -7948,7 +7948,7 @@ rb_thread_cleanup()
{
rb_thread_t th;
if (curr_thread != curr_thread->next->prev) {
while (curr_thread->status == THREAD_KILLED) {
curr_thread = curr_thread->prev;
}
@ -8049,23 +8049,18 @@ rb_thread_trap_eval(cmd, sig)
}
static VALUE
rb_thread_raise(argc, argv, thread)
rb_thread_raise(argc, argv, th)
int argc;
VALUE *argv;
VALUE thread;
rb_thread_t th;
{
rb_thread_t th = rb_thread_check(thread);
if (rb_thread_dead(th)) return Qnil;
if (curr_thread == th) {
rb_f_raise(argc, argv);
}
if (ruby_safe_level > th->safe) {
rb_secure(4);
}
if (THREAD_SAVE_CONTEXT(curr_thread)) {
return thread;
return th->thread;
}
rb_scan_args(argc, argv, "11", &th_raise_argv[0], &th_raise_argv[1]);
@ -8079,6 +8074,20 @@ rb_thread_raise(argc, argv, thread)
return Qnil; /* not reached */
}
static VALUE
rb_thread_raise_m(argc, argv, thread)
int argc;
VALUE *argv;
VALUE thread;
{
rb_thread_t th = rb_thread_check(thread);
if (ruby_safe_level > th->safe) {
rb_secure(4);
}
rb_thread_raise(argc, argv, th);
}
VALUE
rb_thread_local_aref(thread, id)
VALUE thread;
@ -8332,7 +8341,7 @@ Init_Thread()
rb_define_method(rb_cThread, "join", rb_thread_join, 0);
rb_define_method(rb_cThread, "alive?", rb_thread_alive_p, 0);
rb_define_method(rb_cThread, "stop?", rb_thread_stop_p, 0);
rb_define_method(rb_cThread, "raise", rb_thread_raise, -1);
rb_define_method(rb_cThread, "raise", rb_thread_raise_m, -1);
rb_define_method(rb_cThread, "abort_on_exception", rb_thread_abort_exc, 0);
rb_define_method(rb_cThread, "abort_on_exception=", rb_thread_abort_exc_set, 1);

View file

@ -108,6 +108,7 @@ class PStore
begin
file.rewind
Marshal::dump(@table, file)
file.truncate(file.pos)
rescue
File::rename backup, @filename if File::exist?(backup)
raise

View file

@ -16,9 +16,11 @@
class Tracer
@RCS_ID='-$Id: tracer.rb,v 1.8 1998/05/19 03:42:49 keiju Exp keiju $-'
@stdout = STDOUT
class << self
attr :verbose, true
alias verbose? verbose
attr :stdout, true
end
verbose = true
@ -44,6 +46,10 @@ class Tracer
@filters = []
end
def stdout
Tracer.stdout
end
def on
if block_given?
on
@ -56,13 +62,13 @@ class Tracer
set_trace_func proc{|event, file, line, id, binding, klass|
trace_func event, file, line, id, binding
}
print "Trace on\n" if Tracer.verbose?
stdout.print "Trace on\n" if Tracer.verbose?
end
end
def off
set_trace_func nil
print "Trace off\n" if Tracer.verbose?
stdout.print "Trace off\n" if Tracer.verbose?
end
def add_filter(p = proc)
@ -79,7 +85,7 @@ class Tracer
end
unless list = LINES__[file]
# print file if $DEBUG
# stdout.print file if $DEBUG
begin
f = open(file)
begin
@ -108,14 +114,14 @@ class Tracer
def trace_func(event, file, line, id, binding)
return if file == MY_FILE_NAME
#printf "Th: %s\n", Thread.current.inspect
#stdout.printf "Th: %s\n", Thread.current.inspect
for p in @filters
return unless p.call event, file, line, id, binding
end
Thread.critical = true
printf("#%d:%s:%d:%s: %s",
stdout.printf("#%d:%s:%d:%s: %s",
get_thread_no,
file,
line,

View file

@ -512,7 +512,7 @@ The variable ruby-indent-level controls the amount of indentation.
(setq end (point))
(beginning-of-line)
(if (re-search-forward "^\\s *#" end t)
(forward-line 1)
(beginning-of-line)
(setq done t))))
(setq bol (point))
(end-of-line)

View file

@ -1271,6 +1271,7 @@ primary : literal
/* NOEX_PRIVATE for toplevel */
$$ = NEW_DEFN($2, $4, $5, class_nest?NOEX_PUBLIC:NOEX_PRIVATE);
if (is_attrset_id($2)) $$->nd_noex = NOEX_PUBLIC;
fixpos($$, $4);
local_pop();
cur_mid = 0;