예제 #1
0
파일: zactor.c 프로젝트: Cargo-Labs/czmq
zsock_t *
zactor_sock (zactor_t *self)
{
    assert (self);
    assert (zactor_is (self));
    return self->pipe;
}
예제 #2
0
파일: zactor.c 프로젝트: Cargo-Labs/czmq
void *
zactor_resolve (void *self)
{
    assert (self);
    if (zactor_is (self))
        return zsock_resolve (((zactor_t *) self)->pipe);
    else
        return self;
}
예제 #3
0
파일: zsock.c 프로젝트: HunterChen/czmq
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;
}
예제 #4
0
파일: zactor.c 프로젝트: csyangbinbin/czmq
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;
    }
}
예제 #5
0
파일: zactor.c 프로젝트: Cargo-Labs/czmq
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;
    }
}
예제 #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;
}