- Timestamp:
- Nov 15, 2011 11:56:51 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/packages/vizservers/vtkvis/ResponseQueue.cpp
r2543 r2681 29 29 ResponseQueue::~ResponseQueue() 30 30 { 31 TRACE("Deleting ResponseQueue"); 31 32 pthread_mutex_destroy(&_idle); 32 33 if (sem_destroy(&_ready) < 0) { 33 34 ERROR("can't destroy semaphore: %s", strerror(errno)); 34 35 } 36 for (std::list<Response *>::iterator itr = _list.begin(); 37 itr != _list.end(); ++itr) { 38 delete *itr; 39 } 40 _list.clear(); 35 41 } 36 42 … … 64 70 ResponseQueue::dequeue() 65 71 { 66 Response *response ;72 Response *response = NULL; 67 73 68 74 if (sem_wait(&_ready) < 0) { … … 71 77 if (pthread_mutex_lock(&_idle) != 0) { 72 78 ERROR("can't lock mutex: %s", strerror(errno)); 73 } 74 response = _list.front(); 75 _list.pop_front(); 79 } 80 if (_list.empty()) { 81 ERROR("Empty queue"); 82 } else { 83 response = _list.front(); 84 _list.pop_front(); 85 } 76 86 if (pthread_mutex_unlock(&_idle) != 0) { 77 87 ERROR("can't unlock mutex: %s", strerror(errno));
Note: See TracChangeset
for help on using the changeset viewer.