mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 15:30:52 +01:00
ircd::ctx: Give ctx::ctx the instance_list.
This commit is contained in:
parent
281a9e1cfd
commit
3b32d2170e
2 changed files with 16 additions and 0 deletions
|
@ -45,6 +45,8 @@ namespace ircd::ctx
|
|||
|
||||
IRCD_OVERLOAD(threadsafe)
|
||||
|
||||
extern const std::list<ctx *> &ctxs; // List of all ctx instances
|
||||
|
||||
const uint64_t &id(const ctx &); // Unique ID for context
|
||||
string_view name(const ctx &); // User's optional label for context
|
||||
const int64_t ¬es(const ctx &); // Peeks at internal semaphore count
|
||||
|
|
14
ircd/ctx.cc
14
ircd/ctx.cc
|
@ -15,6 +15,7 @@
|
|||
/// Internal context implementation
|
||||
///
|
||||
struct ircd::ctx::ctx
|
||||
:instance_list<ctx>
|
||||
{
|
||||
using error_code = boost::system::error_code;
|
||||
|
||||
|
@ -56,6 +57,19 @@ struct ircd::ctx::ctx
|
|||
ctx(const ctx &) = delete;
|
||||
};
|
||||
|
||||
/// Instance list linkage for the list of all ctx instances.
|
||||
template<>
|
||||
decltype(ircd::util::instance_list<ircd::ctx::ctx>::list)
|
||||
ircd::util::instance_list<ircd::ctx::ctx>::list
|
||||
{};
|
||||
|
||||
/// Public interface linkage for the list of all ctx instances
|
||||
decltype(ircd::ctx::ctxs)
|
||||
ircd::ctx::ctxs
|
||||
{
|
||||
ctx::ctx::list
|
||||
};
|
||||
|
||||
/// Monotonic ctx id counter state. This counter is incremented for each
|
||||
/// newly created context.
|
||||
decltype(ircd::ctx::ctx::id_ctr)
|
||||
|
|
Loading…
Reference in a new issue