A global context which is used by default by all sockets, unless they are
explicitly constructed with a different context.
The $(ZMQ) Guide has the following to say about context creation:
$(QUOTE
You should create and use exactly one context in your process.
[$(LDOTS)] If at runtime a process has two contexts, these are
like separate $(ZMQ) instances. If that's explicitly what you
want, OK, but otherwise remember: $(EM Do one $(D zmq_ctx_new())
at the start of your main line code, and one $(D zmq_ctx_destroy())
at the end.)
)
By using defaultContext(), this is exactly what you achieve. The
context is created the first time the function is called, and is
automatically destroyed when the program ends.
A global context which is used by default by all sockets, unless they are explicitly constructed with a different context.
The $(ZMQ) Guide has the following to say about context creation: $(QUOTE You should create and use exactly one context in your process. [$(LDOTS)] If at runtime a process has two contexts, these are like separate $(ZMQ) instances. If that's explicitly what you want, OK, but otherwise remember: $(EM Do one $(D zmq_ctx_new()) at the start of your main line code, and one $(D zmq_ctx_destroy()) at the end.) ) By using defaultContext(), this is exactly what you achieve. The context is created the first time the function is called, and is automatically destroyed when the program ends.
This function is thread safe.