About the lock in ZMQVan::SendMsg
microwish opened this issue · comments
microwish commented
Might the granularity of the lock be smaller? I'm not sure.
I feel that reasons why the lock guards the whole function body are:
- protect senders_ from racing
- keep the data transfer to the socket continuously and avoid being interrupted
As for reason 1, smaller granularity is acceptable.
As for reason 2, perhaps other operations than locking could be tried.
Yimin Jiang commented
@microwish SendMsg
is an asynchronous call and will return immediately (http://api.zeromq.org/2-1:zmq-send), so the lock granularity does not matter too much in terms of the performance.