ircd::ctx::pool: Add option for dispatch strategy; behavior changed by default.
This commit is contained in:
parent
ea92976369
commit
34bd1e0709
|
@ -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};
|
||||
};
|
||||
|
||||
template<class F,
|
||||
|
|
|
@ -90,6 +90,7 @@ ircd::client::pool_opts
|
|||
{
|
||||
.stack_size = size_t(settings.stack_size),
|
||||
.initial_ctxs = size_t(settings.pool_size),
|
||||
.dispatch = ctx::dock::opts::SORT,
|
||||
};
|
||||
|
||||
/// The pool of request contexts. When a client makes a request it does so by acquiring
|
||||
|
|
|
@ -1589,9 +1589,14 @@ void
|
|||
ircd::ctx::pool::work()
|
||||
try
|
||||
{
|
||||
const auto pop_opts
|
||||
{
|
||||
opt->dispatch
|
||||
};
|
||||
|
||||
const auto func
|
||||
{
|
||||
q.pop()
|
||||
q.pop(pop_opts)
|
||||
};
|
||||
|
||||
const scope_notify notify
|
||||
|
|
Loading…
Reference in New Issue