268 :(id<OOAsyncWorkTask>)task
269{
270 if (task ==
nil)
return;
271
272#if OO_DEBUG
273 NSParameterAssert([(id)task respondsToSelector:@selector(completeAsyncTask)]);
274 NSAssert1(![NSThread respondsToSelector:@selector(isMainThread)] || [[NSThread self] isMainThread], @"%s can only be called from the main thread.", __PRETTY_FUNCTION__);
275#endif
276
277 [_pendingOpsLock lock];
278 BOOL exists = [_pendingCompletableOperations containsObject:task];
279 if (exists) [_pendingCompletableOperations removeObject:task];
280 [_pendingOpsLock unlock];
281
282 if (!exists) return;
283
285 do
286 {
287
288 next = [_readyQueue dequeue];
289 [_pendingOpsLock lock];
290 [_pendingCompletableOperations removeObject:next];
291 [_pendingOpsLock unlock];
292
293 [next completeAsyncTask];
294
295 } while (next != task);
296}