feature
authorStefan Metzmacher <metze@samba.org>
Mon, 5 Jan 2009 07:50:07 +0000 (08:50 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 4 Oct 2016 12:52:32 +0000 (14:52 +0200)
lib/tevent/tevent.c
lib/tevent/tevent.h
lib/tevent/tevent_epoll.c
lib/tevent/tevent_internal.h
lib/tevent/tevent_select.c

index 99cd074e655aa6adec1a1b69d5c62b4a1adb5853..2cebe51939ae97619a7c05a950adf8a5317702ba 100644 (file)
@@ -409,6 +409,10 @@ struct tevent_context *tevent_context_init_ops(TALLOC_CTX *mem_ctx,
        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);
index 7de04d03896c17958d1ad9cc94a3bfdae44dedf2..e004e42a37bbbe14c7b6b0332b57d7e2f2ff29ac 100644 (file)
@@ -29,6 +29,7 @@
 #define __TEVENT_H__
 
 #include <stdint.h>
+#include <stdbool.h>
 #include <talloc.h>
 #include <sys/time.h>
 #include <stdbool.h>
@@ -158,6 +159,13 @@ const char **tevent_backend_list(TALLOC_CTX *mem_ctx);
  */
 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.
index 4147c67af2a014ed16b829c7730ac0f1fbb93a34..0e47a018fd50401c1052fb7b0ccab3494ba984e8 100644 (file)
@@ -758,6 +758,7 @@ static int epoll_event_context_init(struct tevent_context *ev)
                return ret;
        }
 
+       ev->features |= TEVENT_FEATURE_SIGNAL_SUPPORT;
        ev->additional_data = epoll_ev;
        return 0;
 }
index 6f0ecfdbe3f22a15bd9b33de6a825fdaba880fb9..8d72ee5869f828164463d00a9f242e160e41f717 100644 (file)
@@ -246,6 +246,8 @@ struct tevent_context {
        /* 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
index 55dd0b66f66c52eb8fea3e3ed78e973ca643c6bb..9a1e36dd617659a9cc88b98cf6f4f7616abf4349 100644 (file)
@@ -54,6 +54,7 @@ static int select_event_context_init(struct tevent_context *ev)
        if (!select_ev) return -1;
        select_ev->ev = ev;
 
+       ev->features |= TEVENT_FEATURE_SIGNAL_SUPPORT;
        ev->additional_data = select_ev;
        return 0;
 }