From 34bd1e0709f66fa2d32a74d1eea4f5bd7b0a6a93 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 20 Feb 2023 12:19:12 -0800 Subject: [PATCH] ircd::ctx::pool: Add option for dispatch strategy; behavior changed by default. --- include/ircd/ctx/pool.h | 6 ++++++ ircd/client.cc | 1 + ircd/ctx.cc | 7 ++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/ircd/ctx/pool.h b/include/ircd/ctx/pool.h index eaf0c5605..ea994ed27 100644 --- a/include/ircd/ctx/pool.h +++ b/include/ircd/ctx/pool.h @@ -115,6 +115,12 @@ struct ircd::ctx::pool::opts /// Scheduler priority nice value for contexts in this pool. int8_t nice {0}; + + /// Worker dispatch strategy. + /// - FIFO: Dispatch fairly (round-robin). + /// - LIFO: Dispatch the last to finish. + /// - SORT: Like LIFO but lower ID's are given partial precedence. + dock::opts dispatch {dock::opts::LIFO}; }; templatedispatch + }; + const auto func { - q.pop() + q.pop(pop_opts) }; const scope_notify notify