fix: keep slot IN_FLIGHT during execution so evaluator sees busy and drops instead of queuing
This commit is contained in:
parent
b714ac132e
commit
e461dfb7a7
|
|
@ -238,13 +238,15 @@ void *event_executor_thread(void *arg) {
|
||||||
/* Fast path: check slot state without poll */
|
/* Fast path: check slot state without poll */
|
||||||
if (atomic_load_explicit(&slot->state, memory_order_acquire) == EXECUTOR_SLOT_READY) {
|
if (atomic_load_explicit(&slot->state, memory_order_acquire) == EXECUTOR_SLOT_READY) {
|
||||||
signal_entry_t sig = slot->signal;
|
signal_entry_t sig = slot->signal;
|
||||||
atomic_store_explicit(&slot->state, EXECUTOR_SLOT_FREE, memory_order_release);
|
atomic_store_explicit(&slot->state, EXECUTOR_SLOT_IN_FLIGHT, memory_order_release);
|
||||||
/* Drain eventfd so poll can block next time */
|
/* Drain eventfd so poll can block next time */
|
||||||
uint64_t val;
|
uint64_t val;
|
||||||
if (read(slot->eventfd, &val, sizeof(val)) < 0) {}
|
if (read(slot->eventfd, &val, sizeof(val)) < 0) {}
|
||||||
|
|
||||||
executor_execute_triangle(exec, &sig);
|
executor_execute_triangle(exec, &sig);
|
||||||
|
|
||||||
|
atomic_store_explicit(&slot->state, EXECUTOR_SLOT_FREE, memory_order_release);
|
||||||
|
|
||||||
int64_t now = now_mono_ms();
|
int64_t now = now_mono_ms();
|
||||||
if (last_keepalive_ms == 0 || now - last_keepalive_ms >= 30000) {
|
if (last_keepalive_ms == 0 || now - last_keepalive_ms >= 30000) {
|
||||||
executor_keepalive(exec);
|
executor_keepalive(exec);
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,10 @@
|
||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
#include "triangle.h"
|
#include "triangle.h"
|
||||||
|
|
||||||
#define EXECUTOR_SLOT_FREE 0
|
#define EXECUTOR_SLOT_FREE 0
|
||||||
#define EXECUTOR_SLOT_CLAIMED 1
|
#define EXECUTOR_SLOT_CLAIMED 1
|
||||||
#define EXECUTOR_SLOT_READY 2
|
#define EXECUTOR_SLOT_READY 2
|
||||||
|
#define EXECUTOR_SLOT_IN_FLIGHT 3
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
_Atomic int state;
|
_Atomic int state;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue