From bc7a6f22f23e95aad3ecd42adf9ac2b7b75a47e1 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 7 Jan 2017 21:49:48 -0800 Subject: 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.) --- src/core/defs.h | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src/core/defs.h') 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 { -- cgit v1.2.3-70-g09d2