macsim/src/noc/msgqueue.c
// Remove a message from the head of a queue
Remove a message from the head of a queue
Remove a message from the head of a queue
bool msg_dequeue(msg_queue_t *queue, uint8_t *buf, uint32_min_t *len, rank_t *rank)
{
    msg_queue_entry_t *h = queue->head;
    if (!h) return 0; 
    *rank = h->rank;
    *len = h->len;
    memcpy(buf, h->content, h->len);
    queue->head = h->next;
    if (!h->next) 
	queue->tail = 0;
    free(h);
    queue->count--;
    return 1;
}
bool msg_dequeue ( msg_queue_t * queue , uint8_t * buf , uint32_min_t * len , rank_t * rank ) { msg_queue_entry_t * h = queue -> head ; if ( ! h ) return 0 ; * rank = h -> rank ; * len = h -> len ; memcpy ( buf , h -> content , h -> len ) ; queue -> head = h -> next ; if ( ! h -> next ) queue -> tail = 0 ; free ( h ) ; queue -> count -- ; return 1 ; }
Remove a message from the head of a queue
Remove a message from the head of a queue
// no entry // only one entry