If you send and wait without a timeout, it happens that the actor thread is gone, and its pair socket destroyed, before you get here. Then the calling thread blocks waiting for a reply that never arrives.
The return signalling is done by the zactor wrapper, not the actor itself. This isn't entirely symmetrical, that's true. On Sat, Nov 1, 2014 at 10:18 PM, Arnaud Loonstra <[email protected]> wrote: > Hi all, > > I'm going through the zactor class to understand it better. I'm slightly > confused by the destroy sequence: > > At line 182 of zactor.c: > // Signal the actor to end and wait for the thread exit code > // If the pipe isn't connected any longer, assume child thread > // has already quit due to other reasons and don't collect the > // exit signal. > zsock_set_sndtimeo (self->pipe, 0); > if (zstr_send (self->pipe, "$TERM") == 0) > zsock_wait (self->pipe); > zsock_destroy (&self->pipe); > > So when destroy is called the actor method will receive the $TERM > command. The destroy sequence waits for a signal from the actor command. > > But why the == 0. Doesn't that mean that the zstr_send send 0 bytes thus > failed sending? > > Then the echo_actor example just sets: (line 268) > terminated = true; > It nevers signals back. > > It does work that's why I'm confused about what's happening. > Can anybody turn the light on? :) > > Rg, > > Arnaud > -- > w: http://www.sphaero.org > t: http://twitter.com/sphaero > g: http://github.com/sphaero > i: freenode: sphaero_z25 > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
