revert r59023 because it contans unrelated developping code
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b0c9215f72
commit
e9c440815e
@ -2823,6 +2823,28 @@ __END__
|
|||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_single_exception_on_close
|
||||||
|
a = []
|
||||||
|
t = []
|
||||||
|
10.times do
|
||||||
|
r, w = IO.pipe
|
||||||
|
a << [r, w]
|
||||||
|
t << Thread.new do
|
||||||
|
while r.gets
|
||||||
|
end rescue IOError
|
||||||
|
Thread.current.pending_interrupt?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
a.each do |r, w|
|
||||||
|
w.write -"\n"
|
||||||
|
w.close
|
||||||
|
r.close
|
||||||
|
end
|
||||||
|
t.each do |th|
|
||||||
|
assert_equal false, th.value, '[ruby-core:81581] [Bug #13632]'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_open_mode
|
def test_open_mode
|
||||||
feature4742 = "[ruby-core:36338]"
|
feature4742 = "[ruby-core:36338]"
|
||||||
bug6055 = '[ruby-dev:45268]'
|
bug6055 = '[ruby-dev:45268]'
|
||||||
|
2
thread.c
2
thread.c
@ -2213,6 +2213,8 @@ rb_notify_fd_close(int fd)
|
|||||||
if (wfd->fd == fd) {
|
if (wfd->fd == fd) {
|
||||||
rb_thread_t *th = wfd->th;
|
rb_thread_t *th = wfd->th;
|
||||||
VALUE err = th->vm->special_exceptions[ruby_error_stream_closed];
|
VALUE err = th->vm->special_exceptions[ruby_error_stream_closed];
|
||||||
|
|
||||||
|
wfd->fd = -1; /* ensure we only enqueue once */
|
||||||
rb_threadptr_pending_interrupt_enque(th, err);
|
rb_threadptr_pending_interrupt_enque(th, err);
|
||||||
rb_threadptr_interrupt(th);
|
rb_threadptr_interrupt(th);
|
||||||
busy = 1;
|
busy = 1;
|
||||||
|
27
vm.c
27
vm.c
@ -1004,11 +1004,11 @@ invoke_bmethod(rb_thread_t *th, const rb_iseq_t *iseq, VALUE self, const struct
|
|||||||
static inline VALUE
|
static inline VALUE
|
||||||
invoke_iseq_block_from_c(rb_thread_t *th, const struct rb_captured_block *captured,
|
invoke_iseq_block_from_c(rb_thread_t *th, const struct rb_captured_block *captured,
|
||||||
VALUE self, int argc, const VALUE *argv, VALUE passed_block_handler,
|
VALUE self, int argc, const VALUE *argv, VALUE passed_block_handler,
|
||||||
const rb_cref_t *cref, VALUE additional_type)
|
const rb_cref_t *cref, int is_lambda)
|
||||||
{
|
{
|
||||||
const rb_iseq_t *iseq = rb_iseq_check(captured->code.iseq);
|
const rb_iseq_t *iseq = rb_iseq_check(captured->code.iseq);
|
||||||
int i, opt_pc;
|
int i, opt_pc;
|
||||||
VALUE type = VM_FRAME_MAGIC_BLOCK | additional_type;
|
VALUE type = VM_FRAME_MAGIC_BLOCK | (is_lambda ? VM_FRAME_FLAG_LAMBDA : 0);
|
||||||
rb_control_frame_t *cfp = th->ec.cfp;
|
rb_control_frame_t *cfp = th->ec.cfp;
|
||||||
VALUE *sp = cfp->sp;
|
VALUE *sp = cfp->sp;
|
||||||
const rb_callable_method_entry_t *me = th->passed_bmethod_me;
|
const rb_callable_method_entry_t *me = th->passed_bmethod_me;
|
||||||
@ -1021,7 +1021,7 @@ invoke_iseq_block_from_c(rb_thread_t *th, const struct rb_captured_block *captur
|
|||||||
}
|
}
|
||||||
|
|
||||||
opt_pc = vm_yield_setup_args(th, iseq, argc, sp, passed_block_handler,
|
opt_pc = vm_yield_setup_args(th, iseq, argc, sp, passed_block_handler,
|
||||||
((type & VM_FRAME_FLAG_LAMBDA) ? arg_setup_method : arg_setup_block));
|
(is_lambda ? arg_setup_method : arg_setup_block));
|
||||||
cfp->sp = sp;
|
cfp->sp = sp;
|
||||||
|
|
||||||
if (me == NULL) {
|
if (me == NULL) {
|
||||||
@ -1038,8 +1038,6 @@ invoke_block_from_c_bh(rb_thread_t *th, VALUE block_handler,
|
|||||||
VALUE passed_block_handler, const rb_cref_t *cref,
|
VALUE passed_block_handler, const rb_cref_t *cref,
|
||||||
int is_lambda, int force_blockarg)
|
int is_lambda, int force_blockarg)
|
||||||
{
|
{
|
||||||
VALUE additional_type = is_lambda ? VM_FRAME_FLAG_LAMBDA : 0;
|
|
||||||
|
|
||||||
again:
|
again:
|
||||||
switch (vm_block_handler_type(block_handler)) {
|
switch (vm_block_handler_type(block_handler)) {
|
||||||
case block_handler_type_iseq:
|
case block_handler_type_iseq:
|
||||||
@ -1047,7 +1045,7 @@ invoke_block_from_c_bh(rb_thread_t *th, VALUE block_handler,
|
|||||||
const struct rb_captured_block *captured = VM_BH_TO_ISEQ_BLOCK(block_handler);
|
const struct rb_captured_block *captured = VM_BH_TO_ISEQ_BLOCK(block_handler);
|
||||||
return invoke_iseq_block_from_c(th, captured, captured->self,
|
return invoke_iseq_block_from_c(th, captured, captured->self,
|
||||||
argc, argv, passed_block_handler,
|
argc, argv, passed_block_handler,
|
||||||
cref, additional_type);
|
cref, is_lambda);
|
||||||
}
|
}
|
||||||
case block_handler_type_ifunc:
|
case block_handler_type_ifunc:
|
||||||
return vm_yield_with_cfunc(th, VM_BH_TO_IFUNC_BLOCK(block_handler),
|
return vm_yield_with_cfunc(th, VM_BH_TO_IFUNC_BLOCK(block_handler),
|
||||||
@ -1057,11 +1055,8 @@ invoke_block_from_c_bh(rb_thread_t *th, VALUE block_handler,
|
|||||||
return vm_yield_with_symbol(th, VM_BH_TO_SYMBOL(block_handler),
|
return vm_yield_with_symbol(th, VM_BH_TO_SYMBOL(block_handler),
|
||||||
argc, argv, passed_block_handler);
|
argc, argv, passed_block_handler);
|
||||||
case block_handler_type_proc:
|
case block_handler_type_proc:
|
||||||
if (force_blockarg == FALSE && block_proc_is_lambda(VM_BH_TO_PROC(block_handler))) {
|
if (force_blockarg == FALSE) {
|
||||||
additional_type = VM_FRAME_FLAG_LAMBDA;
|
is_lambda = block_proc_is_lambda(VM_BH_TO_PROC(block_handler));
|
||||||
}
|
|
||||||
else {
|
|
||||||
additional_type = VM_FRAME_FLAG_PROC;
|
|
||||||
}
|
}
|
||||||
block_handler = vm_proc_to_block_handler(VM_BH_TO_PROC(block_handler));
|
block_handler = vm_proc_to_block_handler(VM_BH_TO_PROC(block_handler));
|
||||||
goto again;
|
goto again;
|
||||||
@ -1119,23 +1114,17 @@ invoke_block_from_c_proc(rb_thread_t *th, const rb_proc_t *proc,
|
|||||||
VALUE passed_block_handler, int is_lambda)
|
VALUE passed_block_handler, int is_lambda)
|
||||||
{
|
{
|
||||||
const struct rb_block *block = &proc->block;
|
const struct rb_block *block = &proc->block;
|
||||||
VALUE additional_type = is_lambda ? VM_FRAME_FLAG_LAMBDA : VM_FRAME_FLAG_PROC;
|
|
||||||
|
|
||||||
again:
|
again:
|
||||||
switch (vm_block_type(block)) {
|
switch (vm_block_type(block)) {
|
||||||
case block_type_iseq:
|
case block_type_iseq:
|
||||||
return invoke_iseq_block_from_c(th, &block->as.captured, self, argc, argv, passed_block_handler, NULL, additional_type);
|
return invoke_iseq_block_from_c(th, &block->as.captured, self, argc, argv, passed_block_handler, NULL, is_lambda);
|
||||||
case block_type_ifunc:
|
case block_type_ifunc:
|
||||||
return vm_yield_with_cfunc(th, &block->as.captured, self, argc, argv, passed_block_handler);
|
return vm_yield_with_cfunc(th, &block->as.captured, self, argc, argv, passed_block_handler);
|
||||||
case block_type_symbol:
|
case block_type_symbol:
|
||||||
return vm_yield_with_symbol(th, block->as.symbol, argc, argv, passed_block_handler);
|
return vm_yield_with_symbol(th, block->as.symbol, argc, argv, passed_block_handler);
|
||||||
case block_type_proc:
|
case block_type_proc:
|
||||||
if (block_proc_is_lambda(block->as.proc)) {
|
is_lambda = block_proc_is_lambda(block->as.proc);
|
||||||
additional_type = VM_FRAME_FLAG_LAMBDA;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
additional_type = VM_FRAME_FLAG_PROC;
|
|
||||||
}
|
|
||||||
block = vm_proc_block(block->as.proc);
|
block = vm_proc_block(block->as.proc);
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
@ -1007,7 +1007,6 @@ enum {
|
|||||||
VM_FRAME_FLAG_BMETHOD = 0x0040,
|
VM_FRAME_FLAG_BMETHOD = 0x0040,
|
||||||
VM_FRAME_FLAG_CFRAME = 0x0080,
|
VM_FRAME_FLAG_CFRAME = 0x0080,
|
||||||
VM_FRAME_FLAG_LAMBDA = 0x0100,
|
VM_FRAME_FLAG_LAMBDA = 0x0100,
|
||||||
VM_FRAME_FLAG_PROC = 0x0200,
|
|
||||||
|
|
||||||
/* env flag */
|
/* env flag */
|
||||||
VM_ENV_FLAG_LOCAL = 0x0002,
|
VM_ENV_FLAG_LOCAL = 0x0002,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user