The thread_local std::map here can end up being destructed before
the LokiMQ instance (if both are being destroyed during thread joining),
in which case we segfault by trying to use the map. Move the owning
container into the LokiMQ instead (indexed by the thread) to prevent
that.
Also cleans this code up by:
Don't close control sockets from the proxy thread; socket_t's aren't
necessarily thread safe so this could be causing issues where we trouble
double-closing or using a closed socket.
We can just let them get closed during destruction of the LokiMQ.
Avoid needing shared_ptr's; instead we can just use a unique pointer
with raw pointers in the thread_local cache. This simplifies closing
because all closing will happen during the LokiMQ destruction.
The thread_local
std::map
here can end up being destructed before the LokiMQ instance (if both are being destroyed during thread joining), in which case we segfault by trying to use the map. Move the owning container into the LokiMQ instead (indexed by the thread) to prevent that.Also cleans this code up by:
Don't close control sockets from the proxy thread; socket_t's aren't necessarily thread safe so this could be causing issues where we trouble double-closing or using a closed socket.
We can just let them get closed during destruction of the LokiMQ.
Avoid needing shared_ptr's; instead we can just use a unique pointer with raw pointers in the thread_local cache. This simplifies closing because all closing will happen during the LokiMQ destruction.
Fixes #24