Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make shared CA transaction queue variable extern so it's actually shared #1397

Merged
merged 1 commit into from
Mar 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Source/ASRunLoopQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ AS_SUBCLASSING_RESTRICTED

@end

extern ASCATransactionQueue *_ASSharedCATransactionQueue;
extern dispatch_once_t _ASSharedCATransactionQueueOnceToken;

NS_INLINE ASCATransactionQueue *ASCATransactionQueueGet(void) {
static ASCATransactionQueue *q;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
q = [[ASCATransactionQueue alloc] init];
dispatch_once(&_ASSharedCATransactionQueueOnceToken, ^{
_ASSharedCATransactionQueue = [[ASCATransactionQueue alloc] init];
});
return q;
return _ASSharedCATransactionQueue;
}

@interface ASDeallocQueue : NSObject
Expand Down
3 changes: 3 additions & 0 deletions Source/ASRunLoopQueue.mm
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ @implementation ASCATransactionQueue
// but after most other scheduled work on the runloop has processed.
static int const kASASCATransactionQueueOrder = 1000000;

ASCATransactionQueue *_ASSharedCATransactionQueue;
dispatch_once_t _ASSharedCATransactionQueueOnceToken;

- (instancetype)init
{
if (self = [super init]) {
Expand Down