0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-29 20:28:52 +02:00

ircd::ctx: Give ctx::ctx the instance_list.

This commit is contained in:
Jason Volk 2018-04-19 15:37:58 -07:00
parent 281a9e1cfd
commit 3b32d2170e
2 changed files with 16 additions and 0 deletions

View file

@ -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 &notes(const ctx &); // Peeks at internal semaphore count

View file

@ -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)