From abe46b08a926b20c75abe25d07b5a51f30b309bd Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Tue, 12 Mar 2019 08:22:21 -0700 Subject: [PATCH] Make shared CA transaction queue variable extern so it's actually shared (#1397) --- Source/ASRunLoopQueue.h | 11 ++++++----- Source/ASRunLoopQueue.mm | 3 +++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Source/ASRunLoopQueue.h b/Source/ASRunLoopQueue.h index fca77c0f49..07f3682bbf 100644 --- a/Source/ASRunLoopQueue.h +++ b/Source/ASRunLoopQueue.h @@ -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 diff --git a/Source/ASRunLoopQueue.mm b/Source/ASRunLoopQueue.mm index c85dccb92e..4aefeeb89d 100644 --- a/Source/ASRunLoopQueue.mm +++ b/Source/ASRunLoopQueue.mm @@ -354,6 +354,9 @@ ASSynthesizeLockingMethodsWithMutex(_internalQueueLock) // 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]) {