add comments in EventUtils
This commit is contained in:
@@ -9,8 +9,12 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
// Calls a function on the given base's event thread. This function returns
|
||||||
|
// when the call has been enqueued, not necessarily after it returns.
|
||||||
void forward_to_event_thread(std::shared_ptr<struct event_base> base, std::function<void()>&& fn);
|
void forward_to_event_thread(std::shared_ptr<struct event_base> base, std::function<void()>&& fn);
|
||||||
|
|
||||||
|
// Calls a function on the given base's event thread and waits for it to
|
||||||
|
// return. Returns the value returned on that thread.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T call_on_event_thread(std::shared_ptr<struct event_base> base, std::function<T()>&& compute) {
|
T call_on_event_thread(std::shared_ptr<struct event_base> base, std::function<T()>&& compute) {
|
||||||
std::optional<T> ret;
|
std::optional<T> ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user