On Tue, 2018-04-17 at 13:10 +0000, Cerizza, Giordano wrote:
> 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 wishesDo not destroy the context, it's global. Just close the socket. -- Kind regards, Luca Boccassi
signature.asc
Description: This is a digitally signed message part
_______________________________________________ zeromq-dev mailing list [email protected] https://lists.zeromq.org/mailman/listinfo/zeromq-dev
