Skip to content

Commit 5bccd06

Browse files
committed
rb_io_blocking_operation_exit should not execute with pending interrupts.
1 parent 87d340f commit 5bccd06

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

internal/io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct rb_io_blocking_operation {
2525
// The linked list data structure.
2626
struct ccan_list_node list;
2727

28-
// The execution context of the blocking operation:
28+
// The execution context of the blocking operation.
2929
struct rb_execution_context_struct *ec;
3030
};
3131

thread.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,6 +1930,9 @@ rb_thread_io_blocking_call(struct rb_io* io, rb_blocking_function_t *func, void
19301930
RUBY_VM_CHECK_INTS_BLOCKING(ec);
19311931
goto retry;
19321932
}
1933+
1934+
RUBY_VM_CHECK_INTS_BLOCKING(ec);
1935+
19331936
state = saved_state;
19341937
}
19351938
EC_POP_TAG();
@@ -1944,9 +1947,6 @@ rb_thread_io_blocking_call(struct rb_io* io, rb_blocking_function_t *func, void
19441947
EC_JUMP_TAG(ec, state);
19451948
}
19461949

1947-
/* TODO: check func() */
1948-
RUBY_VM_CHECK_INTS_BLOCKING(ec);
1949-
19501950
// If the error was a timeout, we raise a specific exception for that:
19511951
if (saved_errno == ETIMEDOUT) {
19521952
rb_raise(rb_eIOTimeoutError, "Blocking operation timed out!");
@@ -2768,7 +2768,6 @@ thread_io_close_notify_all(VALUE _io)
27682768
struct rb_io_blocking_operation *blocking_operation;
27692769
ccan_list_for_each(rb_io_blocking_operations(io), blocking_operation, list) {
27702770
rb_execution_context_t *ec = blocking_operation->ec;
2771-
27722771
rb_thread_t *thread = ec->thread_ptr;
27732772

27742773
if (thread->scheduler != Qnil) {
@@ -2814,7 +2813,6 @@ void
28142813
rb_thread_io_close_wait(struct rb_io* io)
28152814
{
28162815
VALUE wakeup_mutex = io->wakeup_mutex;
2817-
28182816
if (!RB_TEST(wakeup_mutex)) {
28192817
// There was nobody else using this file when we closed it, so we never bothered to allocate a mutex:
28202818
return;

0 commit comments

Comments
 (0)