Esempio n. 1
0
void test_poller_exists_with_socket_on_zmq_ctx_term (const int socket_type_)
{
#ifdef ZMQ_HAVE_POLLER
    struct poller_test_data_t poller_test_data;

    poller_test_data.socket_type = socket_type_;

    //  Set up our context and sockets
    poller_test_data.ctx = zmq_ctx_new ();
    TEST_ASSERT_NOT_NULL (poller_test_data.ctx);

    poller_test_data.counter = zmq_atomic_counter_new ();
    TEST_ASSERT_NOT_NULL (poller_test_data.counter);

    void *thread = zmq_threadstart (run_poller, &poller_test_data);
    TEST_ASSERT_NOT_NULL (thread);

    while (zmq_atomic_counter_value (poller_test_data.counter) == 0) {
        msleep (10);
    }

    // Destroy the context
    TEST_ASSERT_SUCCESS_ERRNO (zmq_ctx_destroy (poller_test_data.ctx));

    zmq_threadclose (thread);

    zmq_atomic_counter_destroy (&poller_test_data.counter);
#else
    TEST_IGNORE_MESSAGE ("libzmq without zmq_poller_* support, ignoring test");
#endif
}
Esempio n. 2
0
void
mlm_msg_destroy (mlm_msg_t **self_p)
{
    assert (self_p);
    if (*self_p) {
        mlm_msg_t *self = *self_p;
        free (self->sender);
        free (self->address);
        free (self->subject);
        free (self->tracker);
        zmsg_destroy (&self->content);
        zmq_atomic_counter_destroy (&self->refcount);
        free (self);
        *self_p = NULL;
    }
}