aboutsummaryrefslogtreecommitdiff
path: root/src/core/init.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2021-12-05 22:11:24 -0500
committerGarrett D'Amore <garrett@damore.org>2021-12-05 23:04:45 -0500
commitc9bbe8eb574fe10ff16cc71a23fcc9b31fb8ed04 (patch)
tree3a135bbee8750cc1b1869cfca6a2e6f24bf8e59c /src/core/init.h
parenteee06d1e8365ea1b1aa9363a3c6445745b002324 (diff)
downloadnng-c9bbe8eb574fe10ff16cc71a23fcc9b31fb8ed04.tar.gz
nng-c9bbe8eb574fe10ff16cc71a23fcc9b31fb8ed04.tar.bz2
nng-c9bbe8eb574fe10ff16cc71a23fcc9b31fb8ed04.zip
Use static initialization for lists and mutexes.
This eliminates some run-time initialization, moving it to compile time. Additional follow up work will expand on this to simplify initialization and reduce the need for certain locks.
Diffstat (limited to 'src/core/init.h')
-rw-r--r--src/core/init.h19
1 files changed, 0 insertions, 19 deletions
diff --git a/src/core/init.h b/src/core/init.h
index d21bb4c5..7875ba4c 100644
--- a/src/core/init.h
+++ b/src/core/init.h
@@ -23,23 +23,4 @@ int nni_init(void);
// that all resources used by the library are released back to the system.
void nni_fini(void);
-typedef struct nni_initializer {
- int (*i_init)(void); // i_init is called exactly once
- void (*i_fini)(void); // i_fini is called on shutdown
- int i_once; // private -- initialize to zero
- nni_list_node i_node; // private -- initialize to zero
-} nni_initializer;
-
-// nni_initialize will call the initialization routine exactly once. This is
-// done efficiently, so that if the caller has initialized already, then
-// subsequent calls are "cheap" (no synchronization cost). The initialization
-// function must not itself cause any further calls to nni_initialize; the
-// function should limit itself to initialization of locks and static data
-// structures. When shutting down, the finalizer will be called. The
-// order in which finalizers are called is unspecified.
-//
-// An initializer may fail (due to resource exhaustion), in which case the
-// return value of nni_initialize will be non-zero.
-int nni_initialize(nni_initializer *);
-
#endif // CORE_INIT_H