aboutsummaryrefslogtreecommitdiff
path: root/src/core/defs.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-08 11:18:16 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-08 11:18:16 -0800
commitec2574b09a746709f15d2a3f5de135e29f4bcb52 (patch)
tree25f970232f8093b9ce94969eeed2a5f230e94a89 /src/core/defs.h
parent360d19001b90d92ac2f232efb67e356979b0bc4b (diff)
downloadnng-ec2574b09a746709f15d2a3f5de135e29f4bcb52.tar.gz
nng-ec2574b09a746709f15d2a3f5de135e29f4bcb52.tar.bz2
nng-ec2574b09a746709f15d2a3f5de135e29f4bcb52.zip
Move to generic socket & pipe workers, and up to 4 each.
This should eliminate all need for protocols to do their own thread management tasks.
Diffstat (limited to 'src/core/defs.h')
-rw-r--r--src/core/defs.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/defs.h b/src/core/defs.h
index 98f4e661..9c745660 100644
--- a/src/core/defs.h
+++ b/src/core/defs.h
@@ -37,6 +37,7 @@ typedef struct nni_proto nni_proto;
typedef int nni_signal; // Wakeup channel.
typedef uint64_t nni_time; // Abs. time (usec).
typedef int64_t nni_duration; // Rel. time (usec).
+typedef void (*nni_worker)(void *);
// Used by transports for scatter gather I/O.
typedef struct {
@@ -53,6 +54,9 @@ typedef struct {
#define NNI_ALLOC_STRUCT(s) nni_alloc(sizeof (*s))
#define NNI_FREE_STRUCT(s) nni_free((s), sizeof (*s))
+// Maximum number of socket or pipe worker threads.
+#define NNI_MAXWORKERS 4
+
#define NNI_PUT16(ptr, u) \
do { \
(ptr)[0] = (uint8_t) (((uint16_t) (u)) >> 8); \