| 74 | |
| 75 | |
| 76 | void GenericQ::add(void *item) |
| 77 | { |
| 78 | if(deadYet) return; |
| 79 | if(item == NULL) THROW("NULL argument in GenericQ::add()"); |
| 80 | CriticalSection::SafeLock l(mutex); |
| 81 | if(deadYet) return; |
| 82 | Entry *temp = new Entry; |
| 83 | if(temp == NULL) THROW("Alloc error"); |
| 84 | if(start == NULL) start = temp; |
| 85 | else end->next = temp; |
| 86 | temp->item = item; temp->next = NULL; |
| 87 | end = temp; |
| 88 | hasItem.post(); |
| 89 | } |
| 90 | |
| 91 | |
| 92 | // This will block until there is something in the queue |