aboutsummaryrefslogtreecommitdiff
path: root/src/core/socket.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/socket.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/socket.h')
-rw-r--r--src/core/socket.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/socket.h b/src/core/socket.h
index 4656c5d7..d8b37252 100644
--- a/src/core/socket.h
+++ b/src/core/socket.h
@@ -37,9 +37,14 @@ struct nng_socket {
nni_list s_eps; // active endpoints
nni_list s_pipes; // pipes for this socket
+ nni_list s_events; // pending events
+ nni_list s_notify; // event watchers
+ nni_cv s_notify_cv; // wakes notify thread
+ nni_mtx s_notify_mx; // protects s_notify list
nni_list s_reaps; // pipes to reap
nni_thr s_reaper;
+ nni_thr s_notify_thr;
nni_thr s_worker_thr[NNI_MAXWORKERS];
int s_ep_pend; // EP dial/listen in progress
@@ -48,6 +53,9 @@ struct nng_socket {
int s_senderr; // Protocol state machine use
int s_recverr; // Protocol state machine use
+ nni_event s_recv_ev; // Event for readability
+ nni_event s_send_ev; // Event for sendability
+
uint32_t s_nextid; // Next Pipe ID.
};