mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
cluster/zeromq: Do not call util::fmt() from thread
...util::fmt() uses a static buffer, so this is problematic. I've dabbled a bit replacing std::thread with using threading::BasicThread which would offer Fmt(), but this makes things more complicated. Primarily as BasicThread is registered with the thread manager and the shutdown interactions become entangled. The thread might be terminated before the backend, or vice-versa. Seems nicer for the thread to be owned by the backend.
This commit is contained in:
parent
da673d6577
commit
16c745cee4
1 changed files with 3 additions and 1 deletions
|
@ -356,7 +356,9 @@ bool ZeroMQBackend::DoPublishLogWrites(const logging::detail::LogWriteHeader& he
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroMQBackend::Run() {
|
void ZeroMQBackend::Run() {
|
||||||
util::detail::set_thread_name(zeek::util::fmt("zmq-%p", this));
|
char name[4 + 2 + 16 + 1]{}; // zmq-0x<8byte pointer in hex><nul>
|
||||||
|
snprintf(name, sizeof(name), "zmq-%p", this);
|
||||||
|
util::detail::set_thread_name(name);
|
||||||
ZEROMQ_DEBUG_THREAD_PRINTF(DebugFlag::THREAD, "Thread starting (%p)\n", this);
|
ZEROMQ_DEBUG_THREAD_PRINTF(DebugFlag::THREAD, "Thread starting (%p)\n", this);
|
||||||
|
|
||||||
using MultipartMessage = std::vector<zmq::message_t>;
|
using MultipartMessage = std::vector<zmq::message_t>;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue