Hi,
I have the following problem: I have a source of messages connected to a proxy; 
the PULL/PUSH proxy reroutes the
messages via inproc to a multithreaded service that receives the messages and 
pushes them to a destination sink.
Here some pseudocode to help understand the streaming class:

void main(){
// definition of context (ctx_) and sockets for PULL/PUSH proxy 
(frontend,backend)
(...)
pthread worker[N]
for loop for number of thread
   pthread_create(&worker[i], NULL, worker_task, (void*)ctx_)
try{
   zmq::proxy (*frontend, *backend, NULL);
} catch(...){
  // stuff
}
}

void* worker_task(void *arg){
zmq::context_t *context = (zmq::context_t*) arg;
// definition of the sockets to pull from (socket_from) and push to (socket_to)
(...)
// operations on messages (receive and send)
(...)
// exiting the worker_task
pthead_exit(NULL);
}

Observations: my system hangs before exiting the child thread. I tried to close 
the sockets (zmq_close) and destruct (zmq_term) the context for the child but 
nothing happens. How do I safely leave the thread and move on with my code i.e. 
close the sockets and destroy the context for the proxy, destruct the streaming 
class, and move to operate on the message sink?

Thanks in advance
Best wishes

Giordano Cerizza
NSCL/FRIB
Michigan State University
East Lansing, MI 48824-1321
(517)908-7808
ceri...@nscl.msu.edu<mailto:ceri...@nscl.msu.edu>

_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
https://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to