feat: queue_set_waiter_defer — immediate or call_soon callback mode
queue_waiter_handle stores defer_q/cb/arg, no extra malloc. queue_set_waiter_defer(q, 1) enables call_soon dispatch for waiter callbacks. bbr_integration uses it instead of manual send_waiter_cb wrapper.
This commit is contained in:
1 parent
331d43c6f7
commit
2a259191b9
3 files changed
+35
-7
No files matched your search
@@ -177,10 +177,9 @@ static void send_timer_cb(void* arg) {
|
||||
send_burst((struct test_ctx*)arg);
|
||||
}
|
||||
|
||||
static void send_waiter_cb(struct ll_queue* q, void* arg) {
|
||||
static void send_wtr_cb(struct ll_queue* q, void* arg) {
|
||||
(void)q;
|
||||
struct test_ctx* ctx = (struct test_ctx*)arg;
|
||||
uasync_call_soon(ctx->ua, ctx, send_timer_cb);
|
||||
send_burst((struct test_ctx*)arg);
|
||||
}
|
||||
|
||||
static void send_burst(struct test_ctx* ctx) {
|
||||
@@ -191,7 +190,7 @@ static void send_burst(struct test_ctx* ctx) {
|
||||
if (conn->normalizer && conn->normalizer->input) {
|
||||
if (queue_entry_count(conn->normalizer->input) >= SEND_QUEUE_THRESHOLD) {
|
||||
queue_waiter_wait(conn->normalizer->input, &ctx->waiter,
|
||||
send_waiter_cb, ctx);
|
||||
send_wtr_cb, ctx);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -391,8 +390,10 @@ int main(void) {
|
||||
t0 = now_us();
|
||||
while ((now_us() - t0) < 500000ULL) uasync_poll(ctx.ua, 1);
|
||||
|
||||
if (ctx.sender->connections && ctx.sender->connections->normalizer && ctx.sender->connections->normalizer->input)
|
||||
if (ctx.sender->connections && ctx.sender->connections->normalizer && ctx.sender->connections->normalizer->input) {
|
||||
queue_set_threshold(ctx.sender->connections->normalizer->input, 0, 0);
|
||||
queue_set_waiter_defer(ctx.sender->connections->normalizer->input, 1);
|
||||
}
|
||||
|
||||
/* Start test */
|
||||
printf("\n=== Starting traffic (%d seconds) ===\n\n", TEST_DURATION_MS / 1000);
|
||||
|
||||
Reference in new issue
Block a user