mirror of
https://github.com/matrix-construct/construct
synced 2024-05-19 11:23:45 +02:00
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.
|
/// Scheduler priority nice value for contexts in this pool.
|
||||||
int8_t nice {0};
|
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,
|
template<class F,
|
||||||
|
|
|
@ -90,6 +90,7 @@ ircd::client::pool_opts
|
||||||
{
|
{
|
||||||
.stack_size = size_t(settings.stack_size),
|
.stack_size = size_t(settings.stack_size),
|
||||||
.initial_ctxs = size_t(settings.pool_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
|
/// 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()
|
ircd::ctx::pool::work()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
const auto pop_opts
|
||||||
|
{
|
||||||
|
opt->dispatch
|
||||||
|
};
|
||||||
|
|
||||||
const auto func
|
const auto func
|
||||||
{
|
{
|
||||||
q.pop()
|
q.pop(pop_opts)
|
||||||
};
|
};
|
||||||
|
|
||||||
const scope_notify notify
|
const scope_notify notify
|
||||||
|
|
Loading…
Reference in a new issue