mirror of
https://github.com/matrix-construct/construct
synced 2025-02-20 02:30:07 +01:00
ircd::ctx: Add notify() to dock to rotate the waiters in contrast to notify_one().
This commit is contained in:
parent
6f7dde8fdf
commit
b0bc025ced
1 changed files with 16 additions and 2 deletions
|
@ -50,6 +50,7 @@ class dock
|
|||
|
||||
void notify_all() noexcept;
|
||||
void notify_one() noexcept;
|
||||
void notify() noexcept;
|
||||
|
||||
dock() = default;
|
||||
~dock() noexcept;
|
||||
|
@ -62,6 +63,19 @@ noexcept
|
|||
assert(q.empty());
|
||||
}
|
||||
|
||||
inline void
|
||||
dock::notify()
|
||||
noexcept
|
||||
{
|
||||
if(q.empty())
|
||||
return;
|
||||
|
||||
auto c(q.front());
|
||||
q.pop_front();
|
||||
q.emplace_back(c);
|
||||
ircd::ctx::notify(*c);
|
||||
}
|
||||
|
||||
inline void
|
||||
dock::notify_one()
|
||||
noexcept
|
||||
|
@ -69,7 +83,7 @@ noexcept
|
|||
if(q.empty())
|
||||
return;
|
||||
|
||||
notify(*q.front());
|
||||
ircd::ctx::notify(*q.front());
|
||||
}
|
||||
|
||||
inline void
|
||||
|
@ -78,7 +92,7 @@ noexcept
|
|||
{
|
||||
const auto copy(q);
|
||||
for(const auto &c : copy)
|
||||
notify(*c);
|
||||
ircd::ctx::notify(*c);
|
||||
}
|
||||
|
||||
inline void
|
||||
|
|
Loading…
Add table
Reference in a new issue