Executes an event loop on a separate thread.
More...
#include <wpinet/EventLoopRunner.h>
Executes an event loop on a separate thread.
◆ LoopFunc
◆ EventLoopRunner()
wpi::EventLoopRunner::EventLoopRunner |
( |
| ) |
|
◆ ~EventLoopRunner()
virtual wpi::EventLoopRunner::~EventLoopRunner |
( |
| ) |
|
|
virtual |
◆ ExecAsync()
void wpi::EventLoopRunner::ExecAsync |
( |
LoopFunc |
func | ) |
|
Run a function asynchronously (once) on the loop.
This is safe to call from any thread, but is NOT safe to call from the provided function (it will deadlock).
- Parameters
-
func | function to execute on the loop |
◆ ExecSync()
void wpi::EventLoopRunner::ExecSync |
( |
LoopFunc |
func | ) |
|
Run a function synchronously (once) on the loop.
This is safe to call from any thread, but is NOT safe to call from the provided function (it will deadlock). This does not return until the function finishes executing.
- Parameters
-
func | function to execute on the loop |
◆ GetLoop()
std::shared_ptr< uv::Loop > wpi::EventLoopRunner::GetLoop |
( |
| ) |
|
Get the loop.
If the loop thread is not running, returns nullptr.
- Returns
- The loop
◆ Stop()
void wpi::EventLoopRunner::Stop |
( |
| ) |
|
Stop the loop.
Once the loop is stopped it cannot be restarted. This function does not return until the loop has exited.
The documentation for this class was generated from the following file: