diff options
author | deva <deva> | 2005-04-28 19:44:18 +0000 |
---|---|---|
committer | deva <deva> | 2005-04-28 19:44:18 +0000 |
commit | edb7f06d81d94178aace1a9c29888e4bb800fb6a (patch) | |
tree | bd2d151b6fae96860bbc59c7b74efaef09f29261 | |
parent | 462afcd835fcda9f2888aa268cddc29828978c28 (diff) |
*** empty log message ***
-rw-r--r-- | src/queue.h | 15 |
1 files 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<T>::~Queue() template<typename T> void Queue<T>::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<T>::plength() template<typename T> void Queue<T>::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<T>::lock() template<typename T> void Queue<T>::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 |