This commit is contained in:
Samuel Williams 2025-08-15 05:08:26 +02:00 committed by GitHub
commit 34ff33c7f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 0 additions and 21 deletions

View file

@ -50,7 +50,6 @@ int rb_thread_to_be_killed(VALUE thread);
void rb_thread_acquire_fork_lock(void); void rb_thread_acquire_fork_lock(void);
void rb_thread_release_fork_lock(void); void rb_thread_release_fork_lock(void);
void rb_thread_reset_fork_lock(void); void rb_thread_reset_fork_lock(void);
void rb_mutex_allow_trap(VALUE self, int val);
VALUE rb_uninterruptible(VALUE (*b_proc)(VALUE), VALUE data); VALUE rb_uninterruptible(VALUE (*b_proc)(VALUE), VALUE data);
VALUE rb_mutex_owned_p(VALUE self); VALUE rb_mutex_owned_p(VALUE self);
VALUE rb_exec_recursive_outer_mid(VALUE (*f)(VALUE g, VALUE h, int r), VALUE g, VALUE h, ID mid); VALUE rb_exec_recursive_outer_mid(VALUE (*f)(VALUE g, VALUE h, int r), VALUE g, VALUE h, ID mid);

1
io.c
View file

@ -1864,7 +1864,6 @@ io_allocate_write_buffer(rb_io_t *fptr, int sync)
if (NIL_P(fptr->write_lock)) { if (NIL_P(fptr->write_lock)) {
fptr->write_lock = rb_mutex_new(); fptr->write_lock = rb_mutex_new();
rb_mutex_allow_trap(fptr->write_lock, 1);
} }
} }

View file

@ -36,8 +36,6 @@ struct queue_sleep_arg {
rb_hrtime_t end; rb_hrtime_t end;
}; };
#define MUTEX_ALLOW_TRAP FL_USER1
static void static void
sync_wakeup(struct ccan_list_head *head, long max) sync_wakeup(struct ccan_list_head *head, long max)
{ {
@ -301,12 +299,6 @@ do_mutex_lock(VALUE self, int interruptible_p)
rb_mutex_t *mutex = mutex_ptr(self); rb_mutex_t *mutex = mutex_ptr(self);
rb_atomic_t saved_ints = 0; rb_atomic_t saved_ints = 0;
/* When running trap handler */
if (!FL_TEST_RAW(self, MUTEX_ALLOW_TRAP) &&
th->ec->interrupt_mask & TRAP_INTERRUPT_MASK) {
rb_raise(rb_eThreadError, "can't be called from trap context");
}
if (rb_mutex_trylock(self) == Qfalse) { if (rb_mutex_trylock(self) == Qfalse) {
if (mutex->fiber == fiber) { if (mutex->fiber == fiber) {
rb_raise(rb_eThreadError, "deadlock; recursive locking"); rb_raise(rb_eThreadError, "deadlock; recursive locking");
@ -659,17 +651,6 @@ rb_mutex_synchronize_m(VALUE self)
return rb_mutex_synchronize(self, rb_yield, Qundef); return rb_mutex_synchronize(self, rb_yield, Qundef);
} }
void
rb_mutex_allow_trap(VALUE self, int val)
{
Check_TypedStruct(self, &mutex_data_type);
if (val)
FL_SET_RAW(self, MUTEX_ALLOW_TRAP);
else
FL_UNSET_RAW(self, MUTEX_ALLOW_TRAP);
}
/* Queue */ /* Queue */
#define queue_waitq(q) UNALIGNED_MEMBER_PTR(q, waitq) #define queue_waitq(q) UNALIGNED_MEMBER_PTR(q, waitq)