From ac8415c24ffea645105c3859e814843e81c97f8a Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 16 Jan 2017 16:27:22 -0800 Subject: 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. --- src/core/event.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/core/event.h (limited to 'src/core/event.h') 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 +// +// 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 -- cgit v1.2.3-70-g09d2