/* ==== queue.c ============================================================
* Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu
* Description : Queue functions.
* -Started coding this file.
#include <pthread/copyright.h>
* All routines in this file assume that the queue has been appropriatly
/* ==========================================================================
void pthread_queue_init(struct pthread_queue
*queue
)
/* ==========================================================================
void pthread_queue_enq(struct pthread_queue
*queue
, struct pthread
*thread
)
queue
->q_last
->next
= thread
;
/* ==========================================================================
struct pthread
*pthread_queue_get(struct pthread_queue
*queue
)
/* ==========================================================================
struct pthread
*pthread_queue_deq(struct pthread_queue
*queue
)
struct pthread
*thread
= NULL
;
if (!(queue
->q_next
= queue
->q_next
->next
)) {
/* ==========================================================================
void pthread_queue_remove(struct pthread_queue
*queue
, struct pthread
*thread
)
struct pthread
**current
= &(queue
->q_next
);
struct pthread
*prev
= NULL
;
if (*current
== thread
) {
*current
= (*current
)->next
;
current
= &((*current
)->next
);