Diablo 666 wrote: > Hi, > > > Ok. Fair enough. I believe more people are struggling with the same > > problem. What about writing a simple sync API implementation? > > for my use case, it would be sufficient to check if the underlying queue > is empty. This should be very easy to implement by simply checking if > begin_pos == end_pos in yqueue_t and calling this method via the > socket. This would prevent any use of synchronizing. Do you see any > drawback within this approach?
The problem is that each end of the queue lives in a different thread. Writer thread cannot access read end of the queue and vice versa. Note that there's no mutex that would lock the whole queue and let you check whether it's empty. It's a lock-free queue (synchronisation between the threads is done using CPU's atomic operations and memory barriers). Martin _______________________________________________ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev