the reason is that when calling zmq_close and zmq_term from the same
thread, zmq_close will wait for the message to be sent (but will return
the control to the calling thread)
and then zmq_ctx_destroy will hang forever
see:
https://lists.zeromq.org/pipermail/zeromq-dev/2013-September/022469.html
Signed-off-by: imarom <[email protected]>
void
TrexPublisher::Delete(){
if (m_publisher) {
+
+ /* before calling zmq_close set the linger property to zero
+ (othersie zmq_ctx_destroy might hang forever)
+ */
+ int val = 0;
+ zmq_setsockopt(m_publisher, ZMQ_LINGER, &val, sizeof(val));
+
zmq_close (m_publisher);
m_publisher = NULL;
}