enh(SocketReactor): Add start() method #4833 (#4835)

This commit is contained in:
Lara Dzivdzanovic 2025-01-08 15:48:58 +01:00 committed by GitHub
parent 7495f0592c
commit 336e0e802f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View File

@ -186,6 +186,9 @@ public:
/// until stop() is called (in a separate thread).
/// Can be overriden by inheriting classes.
void start();
/// Starts the SocketReactor.
void stop();
/// Stops the SocketReactor.
///

View File

@ -157,6 +157,12 @@ void SocketReactor::sleep()
}
void SocketReactor::start()
{
_stop.exchange(false);
}
void SocketReactor::stop()
{
if (_stop.exchange(true)) return;