aboutsummaryrefslogtreecommitdiff
path: root/src/core/defs.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-07 21:49:48 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-07 21:52:30 -0800
commitbc7a6f22f23e95aad3ecd42adf9ac2b7b75a47e1 (patch)
tree55ca7c800e9dfa54bb58b3f2323b1cb5996fab09 /src/core/defs.h
parentffdceebc19214f384f1b1b6b358f1b2301384135 (diff)
downloadnng-bc7a6f22f23e95aad3ecd42adf9ac2b7b75a47e1.tar.gz
nng-bc7a6f22f23e95aad3ecd42adf9ac2b7b75a47e1.tar.bz2
nng-bc7a6f22f23e95aad3ecd42adf9ac2b7b75a47e1.zip
Simplify locking for protocols.
In an attempt to simplify the protocol implementation, and hopefully track down a close related race, we've made it so that most protocols need not worry about locks, and can access the socket lock if they do need a lock. They also let the socket manage their workers, for the most part. (The req protocol is special, since it needs a top level work distributor, *and* a resender.)
Diffstat (limited to 'src/core/defs.h')
-rw-r--r--src/core/defs.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/core/defs.h b/src/core/defs.h
index 9ae734f7..98f4e661 100644
--- a/src/core/defs.h
+++ b/src/core/defs.h
@@ -18,24 +18,25 @@
#define NNI_ARG_UNUSED(x) ((void) x);
// These types are common but have names shared with user space.
-typedef struct nng_socket nni_sock;
-typedef struct nng_endpoint nni_ep;
-typedef struct nng_pipe nni_pipe;
-typedef struct nng_msg nni_msg;
-typedef struct nng_sockaddr nni_sockaddr;
+typedef struct nng_socket nni_sock;
+typedef struct nng_endpoint nni_ep;
+typedef struct nng_pipe nni_pipe;
+typedef struct nng_msg nni_msg;
+typedef struct nng_sockaddr nni_sockaddr;
// These are our own names.
-typedef struct nni_tran nni_tran;
-typedef struct nni_tran_ep nni_tran_ep;
-typedef struct nni_tran_pipe nni_tran_pipe;
+typedef struct nni_tran nni_tran;
+typedef struct nni_tran_ep nni_tran_ep;
+typedef struct nni_tran_pipe nni_tran_pipe;
-typedef struct nni_proto_pipe nni_proto_pipe;
-typedef struct nni_proto nni_proto;
+typedef struct nni_proto_sock_ops nni_proto_sock_ops;
+typedef struct nni_proto_pipe_ops nni_proto_pipe_ops;
+typedef struct nni_proto nni_proto;
-typedef int nni_signal; // Turnstile/wakeup channel.
-typedef uint64_t nni_time; // Absolute time (usec).
-typedef int64_t nni_duration; // Relative time (usec).
+typedef int nni_signal; // Wakeup channel.
+typedef uint64_t nni_time; // Abs. time (usec).
+typedef int64_t nni_duration; // Rel. time (usec).
// Used by transports for scatter gather I/O.
typedef struct {