mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-16 01:51:45 +00:00
FairMQRegion and examples/advanced/Region
This commit is contained in:
committed by
Mohammad Al-Turany
parent
65f1b96dc3
commit
221d2567f0
@@ -50,6 +50,25 @@ FairMQMessageZMQ::FairMQMessageZMQ(void* data, const size_t size, fairmq_free_fn
|
||||
}
|
||||
}
|
||||
|
||||
FairMQMessageZMQ::FairMQMessageZMQ(FairMQRegionPtr& region, void* data, const size_t size)
|
||||
: fMessage()
|
||||
{
|
||||
// FIXME: make this zero-copy:
|
||||
// simply taking over the provided buffer can casue premature delete, since region could be destroyed before the message is sent out.
|
||||
// Needs lifetime extension for the ZMQ region.
|
||||
if (zmq_msg_init_size(&fMessage, size) != 0)
|
||||
{
|
||||
LOG(ERROR) << "failed initializing message with size, reason: " << zmq_strerror(errno);
|
||||
}
|
||||
|
||||
memcpy(zmq_msg_data(&fMessage), data, size);
|
||||
|
||||
// if (zmq_msg_init_data(&fMessage, data, size, [](void*, void*){}, nullptr) != 0)
|
||||
// {
|
||||
// LOG(ERROR) << "failed initializing message with data, reason: " << zmq_strerror(errno);
|
||||
// }
|
||||
}
|
||||
|
||||
void FairMQMessageZMQ::Rebuild()
|
||||
{
|
||||
CloseMessage();
|
||||
|
Reference in New Issue
Block a user