WPILibC++  2018.4.1-20180729133221-1141-g00c2cd7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
EventLoopRunner.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2018 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #ifndef WPIUTIL_WPI_EVENTLOOPRUNNER_H_
9 #define WPIUTIL_WPI_EVENTLOOPRUNNER_H_
10 
11 #include <functional>
12 
13 #include "wpi/SafeThread.h"
14 #include "wpi/uv/Loop.h"
15 
16 namespace wpi {
17 
22  public:
24  virtual ~EventLoopRunner();
25 
32  void ExecAsync(std::function<void(wpi::uv::Loop&)> func);
33 
41  void ExecSync(std::function<void(wpi::uv::Loop&)> func);
42 
43  private:
44  class Thread;
46 };
47 
48 } // namespace wpi
49 
50 #endif // WPIUTIL_WPI_EVENTLOOPRUNNER_H_
namespace to hold default to_json function
Definition: SmallString.h:21
void ExecSync(std::function< void(wpi::uv::Loop &)> func)
Run a function synchronously (once) on the loop.
void ExecAsync(std::function< void(wpi::uv::Loop &)> func)
Run a function asynchronously (once) on the loop.
Executes an event loop on a separate thread.
Definition: EventLoopRunner.h:21
Event loop.
Definition: Loop.h:37