diff options
author | deva <deva> | 2005-05-22 15:49:22 +0000 |
---|---|---|
committer | deva <deva> | 2005-05-22 15:49:22 +0000 |
commit | b04122f3f7884de08eb5d59bb3fd2bff829f9039 (patch) | |
tree | 6898a061f4e10a6026faa1ffe4a7a319256dacdf /src/queue.h | |
parent | d74c7a00c417cffdc93a82efa2841e23d823bea6 (diff) |
Added multithreaded encoding support.
Diffstat (limited to 'src/queue.h')
-rw-r--r-- | src/queue.h | 45 |
1 files changed, 3 insertions, 42 deletions
diff --git a/src/queue.h b/src/queue.h index 7c56e93..fa03c8e 100644 --- a/src/queue.h +++ b/src/queue.h @@ -38,6 +38,9 @@ /* * $Log$ + * Revision 1.17 2005/05/22 15:49:22 deva + * Added multithreaded encoding support. + * * Revision 1.16 2005/05/19 14:10:22 deva * * Multithreading rulez? @@ -86,7 +89,6 @@ public: ~Queue(); void push(T *t); - void bpush(T *t); T *pop(); T *peek(); @@ -174,47 +176,6 @@ void Queue<T>::push(T *t) } /** - * Push element on queue from the bottom. - */ -template<typename T> -void Queue<T>::bpush(T *t) -{ - if(locked) { - delete t; - return; - } - - pthread_mutex_lock(&mutex); - - buf_t *b = (buf_t*)xmalloc(sizeof(*b)); - b->data = (void*)t; - - assert(b != NULL); - - if(limit && count > 0) { - T* tmp = (T*)_pop(); - delete tmp; - } - - if(!head) { - head = tail = b; - b->next = b->prev = NULL; - count = 1; - pthread_mutex_unlock(&mutex); - return; - } - - b->prev = head; - b->next = NULL; - if(head) - head->next = b; - head = b; - count++; - - pthread_mutex_unlock(&mutex); -} - -/** * Pop element from queue. * If queue is empty, NULL is returned. */ |