ev->ops = ops;
ev->additional_data = additional_data;
+ /* FD and TIMER events are always supported */
+ ev->features |= TEVENT_FEATURE_FD_SUPPORT;
+ ev->features |= TEVENT_FEATURE_TIMER_SUPPORT;
+
ret = ev->ops->context_init(ev);
if (ret != 0) {
talloc_free(ev);
#define __TEVENT_H__
#include <stdint.h>
+#include <stdbool.h>
#include <talloc.h>
#include <sys/time.h>
#include <stdbool.h>
*/
void tevent_set_default_backend(const char *backend);
+#define TEVENT_FEATURE_FD_SUPPORT 0x00000001
+#define TEVENT_FEATURE_TIMER_SUPPORT 0x00000002
+#define TEVENT_FEATURE_SIGNAL_SUPPORT 0x00000004
+#define TEVENT_FEATURE_AIO_SUPPORT 0x00000008
+
+bool tevent_have_features(struct tevent_context *ev, uint32_t features);
+
#ifdef DOXYGEN
/**
* @brief Add a file descriptor based event.
return ret;
}
+ ev->features |= TEVENT_FEATURE_SIGNAL_SUPPORT;
ev->additional_data = epoll_ev;
return 0;
}
/* the specific events implementation */
const struct tevent_ops *ops;
+ uint32_t features;
+
/*
* The following three pointers are queried on every loop_once
* in the order in which they appear here. Not measured, but
if (!select_ev) return -1;
select_ev->ev = ev;
+ ev->features |= TEVENT_FEATURE_SIGNAL_SUPPORT;
ev->additional_data = select_ev;
return 0;
}