ring-buffer/queue.h
/** Destroy the blocking queue *q* */
Destroy the blocking queue *q
Destroy the blocking queue * q
void queue_destroy(queue_t *q)
{
    if (munmap(q->buffer + q->size, q->size) != 0)
        queue_error_errno("Could not unmap buffer");
    if (munmap(q->buffer, q->size) != 0)
        queue_error_errno("Could not unmap buffer");
    if (close(q->fd) != 0)
        queue_error_errno("Could not close anonymous file");
    if (pthread_mutex_destroy(&q->lock) != 0)
        queue_error_errno("Could not destroy mutex");
    if (pthread_cond_destroy(&q->readable) != 0)
        queue_error_errno("Could not destroy condition variable");
    if (pthread_cond_destroy(&q->writeable) != 0)
        queue_error_errno("Could not destroy condition variable");
}
void queue_destroy ( queue_t * q ) { if ( munmap ( q -> buffer + q -> size , q -> size ) != 0 ) queue_error_errno ( " " ) ; if ( munmap ( q -> buffer , q -> size ) != 0 ) queue_error_errno ( " " ) ; if ( close ( q -> fd ) != 0 ) queue_error_errno ( " " ) ; if ( pthread_mutex_destroy ( & q -> lock ) != 0 ) queue_error_errno ( " " ) ; if ( pthread_cond_destroy ( & q -> readable ) != 0 ) queue_error_errno ( " " ) ; if ( pthread_cond_destroy ( & q -> writeable ) != 0 ) queue_error_errno ( " " ) ; }
Destroy the blocking queue *q
Destroy the blocking queue * q