summaryrefslogtreecommitdiff
path: root/src/core/event.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-16 16:27:22 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-16 16:27:22 -0800
commitac8415c24ffea645105c3859e814843e81c97f8a (patch)
tree7b64b4aab3de6ce5bdd69c3d5b7ead57f4a4b4e7 /src/core/event.h
parentb8f7236aa2928d70d9bff2e1071654982539eeda (diff)
downloadnng-ac8415c24ffea645105c3859e814843e81c97f8a.tar.gz
nng-ac8415c24ffea645105c3859e814843e81c97f8a.tar.bz2
nng-ac8415c24ffea645105c3859e814843e81c97f8a.zip
Start of event framework.
This compiles correctly, but doesn't actually deliver events yet. As part of this, I've made most of the initializables in nng safe to tear-down if uninitialized (or set to zero e.g. via calloc). This makes it loads easier to write the teardown on error code, since I can deinit everything, without worrying about which things have been initialized and which have not.
Diffstat (limited to 'src/core/event.h')
-rw-r--r--src/core/event.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/core/event.h b/src/core/event.h
new file mode 100644
index 00000000..d7faad2e
--- /dev/null
+++ b/src/core/event.h
@@ -0,0 +1,35 @@
+//
+// Copyright 2017 Garrett D'Amore <garrett@damore.org>
+//
+// This software is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+#ifndef CORE_EVENT_H
+#define CORE_EVENT_H
+
+#include "core/defs.h"
+#include "core/list.h"
+
+struct nng_event {
+ int e_type;
+ nni_sock * e_sock;
+ nni_ep * e_ep;
+ nni_pipe * e_pipe;
+
+ int e_done; // true when notify thr is finished
+ int e_pending; // true if event is queued
+ nni_cv e_cv; // signaled when e_done is noted
+ nni_list_node e_node; // location on the socket list
+};
+
+struct nng_notify {
+ nni_list_node n_node;
+ nng_notify_func n_func;
+ void * n_arg;
+ int n_mask;
+};
+
+#endif // CORE_EVENT_H