Seastar
High performance C++ framework for concurrent servers
|
Facility to hold a gate opened using RAII.
A gate::holder is usually obtained using gate::hold.
The gate
is entered when the gate::holder is constructed, And the gate
is left when the gate::holder is destroyed.
Copying the gate::holder reenters the gate
to keep an extra reference on it. Moving the gate::holder is supported and has no effect on the gate
itself.
#include <seastar/core/gate.hh>
Public Member Functions | |
holder () noexcept | |
holder (gate &g) | |
holder (const holder &x) noexcept | |
holder (holder &&x) noexcept | |
~holder () | |
Destroy a holder and leave the referenced gate. | |
holder & | operator= (const holder &x) noexcept |
holder & | operator= (holder &&x) noexcept |
void | release () noexcept |
Leave the held gate . | |
|
inlinenoexcept |
|
inlineexplicit |
Construct a holder by entering the gate
. May throw gate_closed_exception if the gate is already closed.
|
inlinenoexcept |
Construct a holder by copying another holder
. Copying a holder never throws: The original holder has already entered the gate, so even if later the gate was close()d, the copy of the holder is also allowed to enter too. Note that the fiber waiting for the close(), which until now was waiting for the one holder to leave, will now wait for both copies to leave.
|
inlinenoexcept |
Copy-assign another holder. Leave() the current gate before assigning the other one, if they are different. Copying a holder never throws: The original holder has already entered the gate, so even if later the gate was close()d, the copy of the holder is also allowed to enter too. Note that the fiber waiting for the close(), which until now was waiting for the one holder to leave, will now wait for both copies to leave.