summaryrefslogtreecommitdiff
path: root/src/queue.h
diff options
context:
space:
mode:
authordeva <deva>2005-04-30 20:58:51 +0000
committerdeva <deva>2005-04-30 20:58:51 +0000
commit85a7c66cd356a1aac6a9234863382189964d2573 (patch)
treedffb0bdba4ab1f15aff19fe6e6e5b97c0a144606 /src/queue.h
parent741613f816796b21abdc3b140ac9131419fd99de (diff)
Fxed queue mutex deadlock.
Diffstat (limited to 'src/queue.h')
-rw-r--r--src/queue.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/queue.h b/src/queue.h
index 1f8a80f..1437af4 100644
--- a/src/queue.h
+++ b/src/queue.h
@@ -187,17 +187,17 @@ T *Queue<T>::_pop()
template<typename T>
T *Queue<T>::peek()
{
- pthread_mutex_lock(&mutex);
+ // pthread_mutex_lock(&mutex);
T *d;
- assert(count >= 0);
+ // assert(count >= 0);
if(count == 0) {
return NULL;
}
d = (T*)head->data;
- pthread_mutex_unlock(&mutex);
+ // pthread_mutex_unlock(&mutex);
return d;
}
@@ -219,11 +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;
fprintf(stderr, "done\n"); fflush(stderr);
- pthread_mutex_unlock(&mutex);
}
/**
@@ -232,11 +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;
fprintf(stderr, "done\n"); fflush(stderr);
- pthread_mutex_unlock(&mutex);
}
#endif