mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 12:14:51 +00:00
move th->event_serial to rb_thread_sched_item (#15500)
This commit is contained in:
parent
6147b69587
commit
7909ce2a83
Notes:
git
2025-12-12 19:25:08 +00:00
Merged-By: luke-gru <luke.gru@gmail.com>
@ -2988,7 +2988,7 @@ timer_thread_deq_wakeup(rb_vm_t *vm, rb_hrtime_t now, uint32_t *event_serial)
|
||||
static void
|
||||
timer_thread_wakeup_thread_locked(struct rb_thread_sched *sched, rb_thread_t *th, uint32_t event_serial)
|
||||
{
|
||||
if (sched->running != th && th->event_serial == event_serial) {
|
||||
if (sched->running != th && th->sched.event_serial == event_serial) {
|
||||
thread_sched_to_ready_common(sched, th, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ struct rb_thread_sched_waiting {
|
||||
struct ccan_list_node node;
|
||||
};
|
||||
|
||||
// per-Thead scheduler helper data
|
||||
// per-Thread scheduler helper data
|
||||
struct rb_thread_sched_item {
|
||||
struct {
|
||||
struct ccan_list_node ubf;
|
||||
@ -70,6 +70,7 @@ struct rb_thread_sched_item {
|
||||
} node;
|
||||
|
||||
struct rb_thread_sched_waiting waiting_reason;
|
||||
uint32_t event_serial;
|
||||
|
||||
bool finished;
|
||||
bool malloc_stack;
|
||||
|
||||
@ -65,7 +65,7 @@ thread_sched_wait_events(struct rb_thread_sched *sched, rb_thread_t *th, int fd,
|
||||
|
||||
volatile bool timedout = false, need_cancel = false;
|
||||
|
||||
uint32_t event_serial = ++th->event_serial; // overflow is okay
|
||||
uint32_t event_serial = ++th->sched.event_serial; // overflow is okay
|
||||
|
||||
if (ubf_set(th, ubf_event_waiting, (void *)th)) {
|
||||
return false;
|
||||
@ -81,11 +81,11 @@ thread_sched_wait_events(struct rb_thread_sched *sched, rb_thread_t *th, int fd,
|
||||
RB_INTERNAL_THREAD_HOOK(RUBY_INTERNAL_THREAD_EVENT_SUSPENDED, th);
|
||||
|
||||
if (th->sched.waiting_reason.flags == thread_sched_waiting_none) {
|
||||
th->event_serial++;
|
||||
th->sched.event_serial++;
|
||||
// timer thread has dequeued us already, but it won't try to wake us because we bumped our serial
|
||||
}
|
||||
else if (RUBY_VM_INTERRUPTED(th->ec)) {
|
||||
th->event_serial++; // make sure timer thread doesn't try to wake us
|
||||
th->sched.event_serial++; // make sure timer thread doesn't try to wake us
|
||||
need_cancel = true;
|
||||
}
|
||||
else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user