From edb7f06d81d94178aace1a9c29888e4bb800fb6a Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 28 Apr 2005 19:44:18 +0000 Subject: *** empty log message *** --- src/queue.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/queue.h b/src/queue.h index e93d7a4..6b143fd 100644 --- a/src/queue.h +++ b/src/queue.h @@ -57,7 +57,7 @@ public: void plength(); private: - bool locked; + volatile bool locked; int limit; buf_t *head; buf_t *tail; @@ -102,14 +102,13 @@ Queue::~Queue() template void Queue::push(T *t) { - pthread_mutex_lock(&mutex); - if(locked) { delete t; - pthread_mutex_unlock(&mutex); return; } + pthread_mutex_lock(&mutex); + buf_t *b = (buf_t*)xmalloc(sizeof(*b)); b->data = (void*)t; @@ -220,9 +219,9 @@ void Queue::plength() template void Queue::lock() { - pthread_mutex_lock(&mutex); + fprintf(stderr, "Lock this motherfucker..."); fflush(stderr); locked = true; - pthread_mutex_unlock(&mutex); + fprintf(stderr, "done\n"); fflush(stderr); } /** @@ -231,9 +230,9 @@ void Queue::lock() template void Queue::unlock() { - pthread_mutex_lock(&mutex); + fprintf(stderr, "Unlock this motherfucker..."); fflush(stderr); locked = false; - pthread_mutex_unlock(&mutex); + fprintf(stderr, "done\n"); fflush(stderr); } #endif -- cgit v1.2.3