hobbes
a language, embedded compiler, and runtime for efficient dynamic expression evaluation, data storage and analysis
events.H
Go to the documentation of this file.
1 /*******************************
2  * events : a runtime system for reactive programs
3  ******************************/
4 
5 #ifndef HOBBES_EVENTS_EVENTS_HPP_INCLUDED
6 #define HOBBES_EVENTS_EVENTS_HPP_INCLUDED
7 
8 #include <functional>
9 
10 namespace hobbes {
11 
12 // add a read event handler for a file descriptor
13 typedef void (*eventhandler)(int fd, void* ud);
14 
15 // return true to automatically repeat after an interval
16 typedef bool (*timerfunc)();
17 
18 void addTimer(timerfunc f, int millisecInterval);
19 
20 void registerEventHandler(int fd, const std::function<void(int)>& fn, bool vn = false /* only used on BSD */);
21 void registerEventHandler(int fd, eventhandler f, void* ud, bool vn = false /* only used on BSD */);
22 void unregisterEventHandler(int fd);
23 
24 // run a single-step or indefinite event loop
25 bool stepEventLoop();
26 void runEventLoop();
27 
28 // run the event loop for some number of microseconds
29 void runEventLoop(int microsecondDuration);
30 
31 }
32 
33 #endif
34 
void addTimer(timerfunc f, int millisecInterval)
bool stepEventLoop()
void runEventLoop()
Definition: boot.H:7
void unregisterEventHandler(int fd)
void registerEventHandler(int fd, const std::function< void(int)> &fn, bool vn=false)
ExprPtr fn(const str::seq &vns, const ExprPtr &b, const LexicalAnnotation &la)
Definition: expr.H:837
void(* eventhandler)(int fd, void *ud)
Definition: events.H:13
bool(* timerfunc)()
Definition: events.H:16