mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (stack_check): made flag per threads.
* thread.c (rb_thread_set_raised, rb_thread_reset_raised): prefixed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5848032ce5
commit
ecd35c0d96
4 changed files with 33 additions and 17 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Thu Feb 28 13:51:59 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (stack_check): made flag per threads.
|
||||||
|
|
||||||
|
* thread.c (rb_thread_set_raised, rb_thread_reset_raised): prefixed.
|
||||||
|
|
||||||
Thu Feb 28 11:43:56 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Feb 28 11:43:56 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* file.c (rb_file_flock): immediately returns on EAGAIN if
|
* file.c (rb_file_flock): immediately returns on EAGAIN if
|
||||||
|
|
16
eval.c
16
eval.c
|
@ -656,7 +656,7 @@ rb_longjmp(int tag, VALUE mesg)
|
||||||
const char *file;
|
const char *file;
|
||||||
int line = 0;
|
int line = 0;
|
||||||
|
|
||||||
if (thread_set_raised(th)) {
|
if (rb_thread_set_raised(th)) {
|
||||||
th->errinfo = exception_error;
|
th->errinfo = exception_error;
|
||||||
JUMP_TAG(TAG_FATAL);
|
JUMP_TAG(TAG_FATAL);
|
||||||
}
|
}
|
||||||
|
@ -703,7 +703,7 @@ rb_longjmp(int tag, VALUE mesg)
|
||||||
th->errinfo = mesg;
|
th->errinfo = mesg;
|
||||||
}
|
}
|
||||||
else if (status) {
|
else if (status) {
|
||||||
thread_reset_raised(th);
|
rb_thread_reset_raised(th);
|
||||||
JUMP_TAG(status);
|
JUMP_TAG(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -715,7 +715,7 @@ rb_longjmp(int tag, VALUE mesg)
|
||||||
0 /* TODO: id */, 0 /* TODO: klass */);
|
0 /* TODO: id */, 0 /* TODO: klass */);
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_reset_raised(th);
|
rb_thread_reset_raised(th);
|
||||||
JUMP_TAG(tag);
|
JUMP_TAG(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1241,17 +1241,17 @@ rb_with_disable_interrupt(VALUE (*proc)(ANYARGS), VALUE data)
|
||||||
static inline void
|
static inline void
|
||||||
stack_check(void)
|
stack_check(void)
|
||||||
{
|
{
|
||||||
static int overflowing = 0;
|
rb_thread_t *th = GET_THREAD();
|
||||||
|
|
||||||
if (!overflowing && ruby_stack_check()) {
|
if (!rb_thread_stack_overflowing_p(th) && ruby_stack_check()) {
|
||||||
int state;
|
int state;
|
||||||
overflowing = 1;
|
rb_thread_set_stack_overflow(th);
|
||||||
PUSH_TAG();
|
PUSH_TAG();
|
||||||
if ((state = EXEC_TAG()) == 0) {
|
if ((state = EXEC_TAG()) == 0) {
|
||||||
rb_exc_raise(sysstack_error);
|
rb_exc_raise(sysstack_error);
|
||||||
}
|
}
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
overflowing = 0;
|
rb_thread_reset_stack_overflow(th);
|
||||||
JUMP_TAG(state);
|
JUMP_TAG(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1427,6 +1427,8 @@ rb_call0(VALUE klass, VALUE recv, ID mid, int argc, const VALUE *argv, int scope
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stack_check();
|
||||||
|
|
||||||
{
|
{
|
||||||
VALUE val;
|
VALUE val;
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -195,8 +195,16 @@ while (0)
|
||||||
void rb_thread_cleanup(void);
|
void rb_thread_cleanup(void);
|
||||||
void rb_thread_wait_other_threads(void);
|
void rb_thread_wait_other_threads(void);
|
||||||
|
|
||||||
int thread_set_raised(rb_thread_t *th);
|
#define RAISED_EXCEPTION 1
|
||||||
int thread_reset_raised(rb_thread_t *th);
|
#define RAISED_STACKOVERFLOW 2
|
||||||
|
int rb_thread_set_raised(rb_thread_t *th);
|
||||||
|
int rb_thread_reset_raised(rb_thread_t *th);
|
||||||
|
#define rb_thread_set_stack_overflow(th) \
|
||||||
|
((th)->raised_flag |= RAISED_STACKOVERFLOW)
|
||||||
|
#define rb_thread_reset_stack_overflow(th) \
|
||||||
|
((th)->raised_flag &= ~RAISED_STACKOVERFLOW)
|
||||||
|
#define rb_thread_stack_overflowing_p(th) \
|
||||||
|
(((th)->raised_flag & RAISED_STACKOVERFLOW) != 0)
|
||||||
|
|
||||||
VALUE rb_f_eval(int argc, VALUE *argv, VALUE self);
|
VALUE rb_f_eval(int argc, VALUE *argv, VALUE self);
|
||||||
VALUE rb_make_exception(int argc, VALUE *argv);
|
VALUE rb_make_exception(int argc, VALUE *argv);
|
||||||
|
|
16
thread.c
16
thread.c
|
@ -845,22 +845,22 @@ rb_thread_signal_exit(void *thptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
thread_set_raised(rb_thread_t *th)
|
rb_thread_set_raised(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
if (th->raised_flag) {
|
if (th->raised_flag & RAISED_EXCEPTION) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
th->raised_flag = 1;
|
th->raised_flag |= RAISED_EXCEPTION;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
thread_reset_raised(rb_thread_t *th)
|
rb_thread_reset_raised(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
if (th->raised_flag == 0) {
|
if (!(th->raised_flag & RAISED_EXCEPTION)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
th->raised_flag = 0;
|
th->raised_flag &= ~RAISED_EXCEPTION;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3005,7 +3005,7 @@ ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always)
|
||||||
th->tracing = 1;
|
th->tracing = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
raised = thread_reset_raised(th);
|
raised = rb_thread_reset_raised(th);
|
||||||
|
|
||||||
PUSH_TAG();
|
PUSH_TAG();
|
||||||
if ((state = EXEC_TAG()) == 0) {
|
if ((state = EXEC_TAG()) == 0) {
|
||||||
|
@ -3013,7 +3013,7 @@ ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (raised) {
|
if (raised) {
|
||||||
thread_set_raised(th);
|
rb_thread_set_raised(th);
|
||||||
}
|
}
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue