Esempio n. 1
0
zsock_t *
zactor_sock (zactor_t *self)
{
    assert (self);
    assert (zactor_is (self));
    return self->pipe;
}
Esempio n. 2
0
void *
zactor_resolve (void *self)
{
    assert (self);
    if (zactor_is (self))
        return zsock_resolve (((zactor_t *) self)->pipe);
    else
        return self;
}
Esempio n. 3
0
void *
zsock_resolve (void *self)
{
    assert (self);
    if (zsock_is (self))
        return ((zsock_t *) self)->handle;
    else
    if (zactor_is (self))
        return zactor_resolve (self);
    else 
        return self;
}
Esempio n. 4
0
void
zactor_destroy (zactor_t **self_p)
{
    assert (self_p);
    if (*self_p) {
        zactor_t *self = *self_p;
        assert (zactor_is (self));

        //  Signal the actor to end and wait for the thread exit code
        zstr_send (self->pipe, "$TERM");
        zsock_wait (self->pipe);
        zsock_destroy (&self->pipe);
        self->tag = 0xDeadBeef;
        free (self);
        *self_p = NULL;
    }
}
Esempio n. 5
0
void
zactor_destroy (zactor_t **self_p)
{
    assert (self_p);
    if (*self_p) {
        zactor_t *self = *self_p;
        assert (zactor_is (self));

        //  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);
        self->tag = 0xDeadBeef;
        free (self);
        *self_p = NULL;
    }
}
Esempio n. 6
0
///
//  Probe the supplied object, and report if it looks like a zactor_t.
bool QZactor::is (void *self)
{
    bool rv = zactor_is (self);
    return rv;
}