0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd::ctx: Add pool::set convenience.

This commit is contained in:
Jason Volk 2018-08-22 14:08:03 -07:00
parent ea172a3378
commit 6cdb1bba63
3 changed files with 12 additions and 2 deletions

View file

@ -71,7 +71,7 @@ struct ircd::conf::item<void>
string_view get(const mutable_buffer &) const;
bool set(const string_view &);
item(const json::members &, conf::set_cb = {});
item(const json::members &, conf::set_cb);
item(item &&) = delete;
item(const item &) = delete;
virtual ~item() noexcept;

View file

@ -43,6 +43,7 @@ struct ircd::ctx::pool
// control panel
void add(const size_t & = 1);
void del(const size_t & = 1);
void set(const size_t &);
void terminate();
void interrupt();
void join();

View file

@ -1010,6 +1010,15 @@ ircd::ctx::pool::operator()(closure closure)
dock.notify();
}
void
ircd::ctx::pool::set(const size_t &num)
{
if(size() > num)
del(size() - num);
else
add(num - size());
}
void
ircd::ctx::pool::del(const size_t &num)
{
@ -1037,7 +1046,7 @@ ircd::ctx::pool::add(const size_t &num)
void
ircd::ctx::pool::join()
{
del(size());
set(0);
}
void