Skip to content

Commit

Permalink
[ios] Backport removal of dispatch_once_t as an instance variable
Browse files Browse the repository at this point in the history
  • Loading branch information
sjchmiela committed Apr 1, 2020
1 parent 97ffd8a commit d08b03c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 36 deletions.
Expand Up @@ -18,7 +18,6 @@
@interface ABI34_0_0UMExportedModule ()

@property (nonatomic, strong) dispatch_queue_t methodQueue;
@property (nonatomic, assign) dispatch_once_t methodQueueSetupOnce;
@property (nonatomic, strong) NSDictionary<NSString *, NSString *> *exportedMethods;

@end
Expand Down Expand Up @@ -55,14 +54,10 @@ - (NSDictionary *)constantsToExport

- (dispatch_queue_t)methodQueue
{
__weak ABI34_0_0UMExportedModule *weakSelf = self;
dispatch_once(&_methodQueueSetupOnce, ^{
__strong ABI34_0_0UMExportedModule *strongSelf = weakSelf;
if (strongSelf) {
NSString *queueName = [NSString stringWithFormat:@"org.unimodules.%@Queue", [[strongSelf class] exportedModuleName]];
strongSelf.methodQueue = dispatch_queue_create(queueName.UTF8String, DISPATCH_QUEUE_SERIAL);
}
});
if (!_methodQueue) {
NSString *queueName = [NSString stringWithFormat:@"org.unimodules.%@Queue", [[self class] exportedModuleName]];
_methodQueue = dispatch_queue_create(queueName.UTF8String, DISPATCH_QUEUE_SERIAL);
}
return _methodQueue;
}

Expand Down
Expand Up @@ -18,7 +18,6 @@
@interface ABI35_0_0UMExportedModule ()

@property (nonatomic, strong) dispatch_queue_t methodQueue;
@property (nonatomic, assign) dispatch_once_t methodQueueSetupOnce;
@property (nonatomic, strong) NSDictionary<NSString *, NSString *> *exportedMethods;

@end
Expand Down Expand Up @@ -55,14 +54,10 @@ - (NSDictionary *)constantsToExport

- (dispatch_queue_t)methodQueue
{
__weak ABI35_0_0UMExportedModule *weakSelf = self;
dispatch_once(&_methodQueueSetupOnce, ^{
__strong ABI35_0_0UMExportedModule *strongSelf = weakSelf;
if (strongSelf) {
NSString *queueName = [NSString stringWithFormat:@"org.unimodules.%@Queue", [[strongSelf class] exportedModuleName]];
strongSelf.methodQueue = dispatch_queue_create(queueName.UTF8String, DISPATCH_QUEUE_SERIAL);
}
});
if (!_methodQueue) {
NSString *queueName = [NSString stringWithFormat:@"org.unimodules.%@Queue", [[self class] exportedModuleName]];
_methodQueue = dispatch_queue_create(queueName.UTF8String, DISPATCH_QUEUE_SERIAL);
}
return _methodQueue;
}

Expand Down
Expand Up @@ -18,7 +18,6 @@
@interface ABI36_0_0UMExportedModule ()

@property (nonatomic, strong) dispatch_queue_t methodQueue;
@property (nonatomic, assign) dispatch_once_t methodQueueSetupOnce;
@property (nonatomic, strong) NSDictionary<NSString *, NSString *> *exportedMethods;

@end
Expand Down Expand Up @@ -55,14 +54,10 @@ - (NSDictionary *)constantsToExport

- (dispatch_queue_t)methodQueue
{
__weak ABI36_0_0UMExportedModule *weakSelf = self;
dispatch_once(&_methodQueueSetupOnce, ^{
__strong ABI36_0_0UMExportedModule *strongSelf = weakSelf;
if (strongSelf) {
NSString *queueName = [NSString stringWithFormat:@"org.unimodules.%@Queue", [[strongSelf class] exportedModuleName]];
strongSelf.methodQueue = dispatch_queue_create(queueName.UTF8String, DISPATCH_QUEUE_SERIAL);
}
});
if (!_methodQueue) {
NSString *queueName = [NSString stringWithFormat:@"org.unimodules.%@Queue", [[self class] exportedModuleName]];
_methodQueue = dispatch_queue_create(queueName.UTF8String, DISPATCH_QUEUE_SERIAL);
}
return _methodQueue;
}

Expand Down
Expand Up @@ -18,7 +18,6 @@
@interface ABI37_0_0UMExportedModule ()

@property (nonatomic, strong) dispatch_queue_t methodQueue;
@property (nonatomic, assign) dispatch_once_t methodQueueSetupOnce;
@property (nonatomic, strong) NSDictionary<NSString *, NSString *> *exportedMethods;

@end
Expand Down Expand Up @@ -55,14 +54,10 @@ - (NSDictionary *)constantsToExport

- (dispatch_queue_t)methodQueue
{
__weak ABI37_0_0UMExportedModule *weakSelf = self;
dispatch_once(&_methodQueueSetupOnce, ^{
__strong ABI37_0_0UMExportedModule *strongSelf = weakSelf;
if (strongSelf) {
NSString *queueName = [NSString stringWithFormat:@"org.unimodules.%@Queue", [[strongSelf class] exportedModuleName]];
strongSelf.methodQueue = dispatch_queue_create(queueName.UTF8String, DISPATCH_QUEUE_SERIAL);
}
});
if (!_methodQueue) {
NSString *queueName = [NSString stringWithFormat:@"org.unimodules.%@Queue", [[self class] exportedModuleName]];
_methodQueue = dispatch_queue_create(queueName.UTF8String, DISPATCH_QUEUE_SERIAL);
}
return _methodQueue;
}

Expand Down

0 comments on commit d08b03c

Please sign in to comment.