37#ifndef OO_BUGGY_PTHREADS
40#define OO_BUGGY_PTHREADS 1
42#define OO_BUGGY_PTHREADS 0
80@interface OOAsyncQueue (OOPrivate)
97 [_lock setName:@"OOAsyncQueue lock"];
117 OOLogWARN(
@"asyncQueue.nonEmpty",
@"%@ deallocated while non-empty, flushing.",
self);
122 while (
_pool != NULL)
129 [_lock unlockWithCondition:kConditionDead];
139 return [
NSString stringWithFormat:@"<%@ %p>{%u elements}", [
self class],
self, _elemCount];
143- (BOOL)enqueue:(
id)object
162 if (element == NULL)
goto FAIL;
167 element->
next = NULL;
174 element->
next = NULL;
180 assert(
_tail != NULL);
181 assert(
_tail->next == NULL);
184 _tail->next = element;
191 [_lock unlockWithCondition:kConditionQueuedData];
143- (BOOL)enqueue:(
id)object {
…}
198 [_lock lockWhenCondition:kConditionQueuedData];
227 return _head != NULL;
243 [_lock unlockWithCondition:kConditionNoData];
249@implementation OOAsyncQueue (OOPrivate)
256 while (_head != NULL)
290 if (_head == NULL) _tail = NULL;
294 result = [
element->object autorelease];
300 assert((_head == NULL && _tail == NULL && _elemCount == 0) || (_head != NULL && _tail != NULL && _elemCount != 0));
303 [
_lock unlockWithCondition:(_head == NULL) ? kConditionNoData : kConditionQueuedData];
314 element->
next = _pool;
OOINLINE void FreeElement(OOAsyncQueueElement *element)
OOINLINE OOAsyncQueueElement * AllocElement(void)
#define OOLogWARN(class, format,...)
id doDequeAndUnlockWithAcquiredLock()
void doEmptyQueueWithAcquiredLock()
id doDequeAndUnlockWithAcquiredLock()
struct OOAsyncQueueElement * _pool
struct OOAsyncQueueElement * _head
void recycleElementWithAcquiredLock:(OOAsyncQueueElement *element)
void doEmptyQueueWithAcquiredLock()
struct OOAsyncQueueElement * _tail
OOAsyncQueueElement * next