wpiutil: EventLoopRunner: Allow getting the loop shared_ptr.

This commit is contained in:
Peter Johnson
2018-09-23 16:14:56 -07:00
parent 6d99c0ac6c
commit de6d6c9a5c
2 changed files with 12 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
#define WPIUTIL_WPI_EVENTLOOPRUNNER_H_
#include <functional>
#include <memory>
#include "wpi/SafeThread.h"
#include "wpi/uv/Loop.h"
@@ -42,6 +43,12 @@ class EventLoopRunner {
*/
void ExecSync(LoopFunc func);
/**
* Get the loop. If the loop thread is not running, returns nullptr.
* @return The loop
*/
std::shared_ptr<uv::Loop> GetLoop();
private:
class Thread;
SafeThreadOwner<Thread> m_owner;