[zeromq-dev] ffn callback ordering on multi-part message

Luca Boccassi luca.boccassi at gmail.com
Fri Jul 24 10:18:50 CEST 2020


On Tue, 2020-07-21 at 23:34 +0900, ahelr wehrl wrote:
> Dear all,
> If I send a multi-part message each of which is created with "int zmq_msg_init_data (zmq_msg_t *msg, void *data, size_t size, zmq_free_fn *ffn, void *hint)", then the free callback functions are guaranteed to be called in the order that each message is sended, regardless of any implementation depending on OS and hardware?
> Or does this depend on the implementation ?
> 
> The reason I ask this is that if the ordering is guaranteed, I can give the free callback function only on the last multipart message, which gives the chance of minimizing the race conditions among threads. 
> 
> Thanks.

It probably is, but as an implementation accident. There is no
guarantee in the documentation, so it should not be taken as an API
promise. Also, the callback will be invoked from different threads, as
the documentation says, so it needs to be thread safe anyway.

-- 
Kind regards,
Luca Boccassi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20200724/ba6344d1/attachment.sig>


More information about the zeromq-dev mailing list