Skip to content

Commit

Permalink
Improve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Adlai Holler committed May 22, 2018
1 parent 7c43b4e commit 4c8b759
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/ASRunLoopQueue.mm
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ - (void)releaseObjectInBackground:(id _Nullable __strong *)objectPtr

_lock.lock();
auto isFirstEntry = _queue.empty();
// Push the pointer into our queue and clear their strong ref.
// Push the pointer into our queue and clear their pointer.
// This "steals" the +1 from ARC and nils their pointer so they can't
// access or release the object.
_queue.push_back(*cfPtr);
*cfPtr = NULL;
_lock.unlock();
Expand All @@ -238,10 +240,10 @@ - (void)drain
{
@autoreleasepool {
_lock.lock();
// Use move since copying CFTypeRefs = dangerous memory management.
auto q = std::move(_queue);
_lock.unlock();
for (auto ref : q) {
// NOTE: Could check that retain count is 1 and retry later if not.
CFRelease(ref);
}
}
Expand Down
11 changes: 11 additions & 0 deletions examples/CatDealsCollectionView/Sample/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,14 @@ - (void)pushNewViewController
}

@end

@implementation ASConfiguration (UserProvided)

+ (ASConfiguration *)textureConfiguration
{
ASConfiguration *cfg = [[ASConfiguration alloc] init];
cfg.experimentalFeatures = ASExperimentalDeallocQueue;
return cfg;
}

@end

0 comments on commit 4c8b759

Please sign in to comment.