EventLoopRunner: Use AsyncFunction

This commit is contained in:
Peter Johnson
2018-08-14 21:01:20 -07:00
parent 57490e0002
commit 8d8f120cc3
2 changed files with 18 additions and 40 deletions

View File

@@ -20,6 +20,8 @@ namespace wpi {
*/
class EventLoopRunner {
public:
using LoopFunc = std::function<void(wpi::uv::Loop&)>;
EventLoopRunner();
virtual ~EventLoopRunner();
@@ -29,7 +31,7 @@ class EventLoopRunner {
* provided function (it will deadlock).
* @param func function to execute on the loop
*/
void ExecAsync(std::function<void(wpi::uv::Loop&)> func);
void ExecAsync(LoopFunc func);
/**
* Run a function synchronously (once) on the loop.
@@ -38,7 +40,7 @@ class EventLoopRunner {
* This does not return until the function finishes executing.
* @param func function to execute on the loop
*/
void ExecSync(std::function<void(wpi::uv::Loop&)> func);
void ExecSync(LoopFunc func);
private:
class Thread;