mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-16 01:51:45 +00:00
FairMQ: Introduce callbacks for the FairMQUnmanagedRegion.
Callbacks are called when the data buffer of the message assiciated with the corresponding region is no longer needed by the transport. Example in examples/advanced/Region/
This commit is contained in:
committed by
Mohammad Al-Turany
parent
378c47c5e5
commit
58a312b730
@@ -17,10 +17,10 @@
|
||||
|
||||
#include "FairMQMessageZMQ.h"
|
||||
#include "FairMQLogger.h"
|
||||
#include "FairMQUnmanagedRegionZMQ.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
string FairMQMessageZMQ::fDeviceID = string();
|
||||
FairMQ::Transport FairMQMessageZMQ::fTransportType = FairMQ::Transport::ZMQ;
|
||||
|
||||
FairMQMessageZMQ::FairMQMessageZMQ()
|
||||
@@ -50,7 +50,7 @@ FairMQMessageZMQ::FairMQMessageZMQ(void* data, const size_t size, fairmq_free_fn
|
||||
}
|
||||
}
|
||||
|
||||
FairMQMessageZMQ::FairMQMessageZMQ(FairMQUnmanagedRegionPtr& /*region*/, void* data, const size_t size)
|
||||
FairMQMessageZMQ::FairMQMessageZMQ(FairMQUnmanagedRegionPtr& region, void* data, const size_t size)
|
||||
: fMessage()
|
||||
{
|
||||
// FIXME: make this zero-copy:
|
||||
@@ -62,6 +62,8 @@ FairMQMessageZMQ::FairMQMessageZMQ(FairMQUnmanagedRegionPtr& /*region*/, void* d
|
||||
}
|
||||
|
||||
memcpy(zmq_msg_data(&fMessage), data, size);
|
||||
// call region callback
|
||||
static_cast<FairMQUnmanagedRegionZMQ*>(region.get())->fCallback(data, size);
|
||||
|
||||
// if (zmq_msg_init_data(&fMessage, data, size, [](void*, void*){}, nullptr) != 0)
|
||||
// {
|
||||
@@ -116,11 +118,6 @@ void FairMQMessageZMQ::SetMessage(void*, const size_t)
|
||||
// dummy method to comply with the interface. functionality not allowed in zeromq.
|
||||
}
|
||||
|
||||
void FairMQMessageZMQ::SetDeviceId(const string& deviceId)
|
||||
{
|
||||
fDeviceID = deviceId;
|
||||
}
|
||||
|
||||
FairMQ::Transport FairMQMessageZMQ::GetType() const
|
||||
{
|
||||
return fTransportType;
|
||||
|
Reference in New Issue
Block a user