Changeset View
Changeset View
Standalone View
Standalone View
src/httpserver.h
Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | |||||
public: | public: | ||||
/** | /** | ||||
* Create a new event. | * Create a new event. | ||||
* deleteWhenTriggered deletes this event object after the event is | * deleteWhenTriggered deletes this event object after the event is | ||||
* triggered (and the handler called) | * triggered (and the handler called) | ||||
* handler is the handler to call when the event is triggered. | * handler is the handler to call when the event is triggered. | ||||
*/ | */ | ||||
HTTPEvent(struct event_base *base, bool deleteWhenTriggered, | HTTPEvent(struct event_base *base, bool deleteWhenTriggered, | ||||
const std::function<void(void)> &handler); | const std::function<void()> &handler); | ||||
~HTTPEvent(); | ~HTTPEvent(); | ||||
/** | /** | ||||
* Trigger the event. If tv is 0, trigger it immediately. Otherwise trigger | * Trigger the event. If tv is 0, trigger it immediately. Otherwise trigger | ||||
* it after the given time has elapsed. | * it after the given time has elapsed. | ||||
*/ | */ | ||||
void trigger(struct timeval *tv); | void trigger(struct timeval *tv); | ||||
bool deleteWhenTriggered; | bool deleteWhenTriggered; | ||||
std::function<void(void)> handler; | std::function<void()> handler; | ||||
private: | private: | ||||
struct event *ev; | struct event *ev; | ||||
}; | }; | ||||
#endif // BITCOIN_HTTPSERVER_H | #endif // BITCOIN_HTTPSERVER_H |