80@interface OOAsyncQueue (OOPrivate)
96 _lock = [[NSConditionLock alloc] initWithCondition:kConditionNoData];
97 [_lock setName:@"OOAsyncQueue lock"];
117 OOLogWARN(
@"asyncQueue.nonEmpty",
@"%@ deallocated while non-empty, flushing.",
self);
118 [
self doEmptyQueueWithAcquiredLock];
122 while (_pool != NULL)
125 _pool = element->
next;
129 [_lock unlockWithCondition:kConditionDead];
136- (NSString *)description
139 return [NSString stringWithFormat:@"<%@ %p>{%u elements}", [
self class], self, _elemCount];
143- (BOOL)enqueue:(
id)object
156 _pool = element->
next;
162 if (element == NULL)
goto FAIL;
166 element->
object = [object retain];
167 element->
next = NULL;
173 _head = _tail = element;
174 element->
next = NULL;
175 assert(_elemCount == 0);
180 assert(_tail != NULL);
181 assert(_tail->next == NULL);
182 assert(_elemCount != 0);
184 _tail->next = element;
191 [_lock unlockWithCondition:kConditionQueuedData];
198 [_lock lockWhenCondition:kConditionQueuedData];
199 return [
self doDequeAndUnlockWithAcquiredLock];
221 return [
self doDequeAndUnlockWithAcquiredLock];
227 return _head != NULL;