helics
3.5.1
|
#include <ZmqContextManager.h>
Public Member Functions | |
~ZmqContextManager () | |
const std::string & | getName () const |
zmq::context_t & | getBaseContext () const |
Static Public Member Functions | |
static std::shared_ptr< ZmqContextManager > | getContextPointer (const std::string &contextName=std::string{}) |
static zmq::context_t & | getContext (const std::string &contextName=std::string{}) |
static void | startContext (const std::string &contextName=std::string{}) |
static void | closeContext (const std::string &contextName=std::string{}) |
static bool | setContextToLeakOnDelete (const std::string &contextName=std::string{}) |
static bool | setContextToNotLeakOnDelete (const std::string &contextName=std::string{}) |
class defining a global context manager for all zmq usage
the zmq::context_t is stored in global structure so more than one can exist, but most use cases it is just the equivalent of a singleton
ZmqContextManager::~ZmqContextManager | ( | ) |
destructor
|
static |
close a ZMQ context if it exists
|
inline |
get a reference to the underlying zmq::context_t for use with cppzmq library calls
|
static |
get an underlying zmq::context_t reference by name
References getContextPointer().
|
static |
get a shared_ptr to the context by name
Referenced by getContext(), and helics::apps::zmqBrokerServer::stopServer().
|
inline |
get the name of the context
|
static |
tell the context to free the pointer and leak the memory on delete
You may ask why, well in windows systems when operating in a DLL if this context is closed after certain other operations that happen when the DLL is unlinked bad things can happen, and since in nearly all cases this happens at Shutdown leaking really doesn't matter that much, it also seem to be required when the zmq library is built with curve instead of turning off the encryption or with sodium, in that case there seems to be some issues in the zmq library itself when closing the context, causing some issue that eventually leads to something trying to access a deleted mutex on program shutdown. Which is annoying.
|
static |
turn off the leak on delete mode
|
static |
start a ZMQ context if it hasn't been started already