[zeromq-dev] zactor destroy sequence

Arnaud Loonstra arnaud at sphaero.org
Sat Nov 1 22:18:21 CET 2014


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



More information about the zeromq-dev mailing list