37#ifndef OO_BUGGY_PTHREADS
40#define OO_BUGGY_PTHREADS 1
42#define OO_BUGGY_PTHREADS 0
72@interface OOAsyncQueue (OOPrivate)
87 [_lock setName:@"OOAsyncQueue lock"];
104 OOLogWARN(
@"asyncQueue.nonEmpty",
@"%@ deallocated while non-empty, flushing.",
self);
109 while (
_pool != NULL) {
115 [_lock unlockWithCondition:kConditionDead];
124 return [
NSString stringWithFormat:@"<%@ %p>{%u elements}", [
self class],
self, _elemCount];
127- (BOOL)enqueue:(
id)object
150 element->
next = NULL;
156 element->
next = NULL;
160 assert(
_tail != NULL);
161 assert(
_tail->next == NULL);
164 _tail->next = element;
171 [_lock unlockWithCondition:kConditionQueuedData];
177 [_lock lockWhenCondition:kConditionQueuedData];
204 return _head != NULL;
218 [_lock unlockWithCondition:kConditionNoData];
223@implementation OOAsyncQueue (OOPrivate)
230 while (_head != NULL) {
266 result = [
element->object autorelease];
272 assert((_head == NULL && _tail == NULL && _elemCount == 0) || (_head != NULL && _tail != NULL && _elemCount != 0));
275 [
_lock unlockWithCondition:(_head == NULL) ? kConditionNoData : kConditionQueuedData];
284 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