Exemplo n.º 1
0
void nn_worker_term (struct nn_worker *self)
{
    /*  Ask worker thread to terminate. */
    nn_mutex_lock (&self->sync);
    nn_queue_push (&self->tasks, &self->stop);
    nn_efd_signal (&self->efd);
    nn_mutex_unlock (&self->sync);

    /*  Wait till worker thread terminates. */
    nn_thread_term (&self->thread);

    /*  Clean up. */
    nn_timerset_term (&self->timerset);
    nn_poller_term (&self->poller);
    nn_efd_term (&self->efd);
    nn_queue_item_term (&self->stop);
    nn_queue_term (&self->tasks);
    nn_mutex_term (&self->sync);
}
Exemplo n.º 2
0
MgErr ftw_nanomsg_unreserve(struct ftw_socket_callsite **inst)
{
    /*  Preconditions expected of LabVIEW. */
    ftw_assert(inst);

    if (*inst) {
        ftw_nanomsg_shutdown_active_sockets(*inst);
        nn_mutex_term(&(*inst)->sync);
        ftw_debug("Unreserving Socket %d", (*inst)->id);
        ftw_assert(ftw_free(*inst) == mgNoErr);

        /*  LabVIEW retains the lifetime of this pointer for each session. For this reason,
            NULL its value so that it does not continue to point to freed memory. */
        *inst = NULL;
    }
    else {
        ftw_debug("No-op socket callsite unloaded.");
    }

    return mgNoErr;
}
Exemplo n.º 3
0
void nn_alloc_term (void)
{
    nn_mutex_term (&nn_alloc_sync);
}
Exemplo n.º 4
0
Arquivo: ins.c Projeto: 4ker/nanomsg
void nn_ins_term (void)
{
    nn_list_term (&self.connected);
    nn_list_term (&self.bound);
    nn_mutex_term (&self.sync);
}
Exemplo n.º 5
0
void nn_atomic_term (struct nn_atomic *self)
{
#if defined NN_ATOMIC_MUTEX
    nn_mutex_term (&self->sync);
#endif
}