diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2020-02-25 13:03:05 -0500 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2020-02-25 13:03:05 -0500 |
commit | 4da610726f9a1453bbffc0d88589add532980b26 (patch) | |
tree | 327dd8263925ad205d92c4012e888a05c40e3093 | |
parent | 46ab8a0ec02fd20a9c646ce66a90746d1fc89737 (diff) | |
download | sdl_ios-bugfix/issue-1564-correlationId-thread-safety.tar.gz |
Use constants instead of stringsbugfix/issue-1564-correlationId-thread-safety
-rw-r--r-- | SmartDeviceLink/SDLGlobals.h | 3 | ||||
-rw-r--r-- | SmartDeviceLink/SDLGlobals.m | 12 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLifecycleManager.m | 2 |
3 files changed, 10 insertions, 7 deletions
diff --git a/SmartDeviceLink/SDLGlobals.h b/SmartDeviceLink/SDLGlobals.h index 2d4edf017..004a0e8d9 100644 --- a/SmartDeviceLink/SDLGlobals.h +++ b/SmartDeviceLink/SDLGlobals.h @@ -26,6 +26,9 @@ extern NSUInteger const SDLDefaultMTUSize; extern NSUInteger const SDLV1MTUSize; extern NSUInteger const SDLV3MTUSize; +extern void *const SDLProcessingQueueName; +extern void *const SDLConcurrentQueueName; + @interface SDLGlobals : NSObject @property (copy, nonatomic, readonly) SDLVersion *protocolVersion; diff --git a/SmartDeviceLink/SDLGlobals.m b/SmartDeviceLink/SDLGlobals.m index f948fb89c..dc78e7a56 100644 --- a/SmartDeviceLink/SDLGlobals.m +++ b/SmartDeviceLink/SDLGlobals.m @@ -22,6 +22,8 @@ NSUInteger const SDLDefaultMTUSize = UINT32_MAX; NSUInteger const SDLV1MTUSize = 1024; NSUInteger const SDLV3MTUSize = 131024; +void *const SDLProcessingQueueName = "com.sdl.serialProcessing"; +void *const SDLConcurrentQueueName = "com.sdl.concurrentProcessing"; typedef NSNumber *ServiceTypeBox; typedef NSNumber *MTUBox; @@ -61,12 +63,10 @@ typedef NSNumber *MTUBox; dispatch_queue_attr_t qosSerial = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_USER_INITIATED, 0); dispatch_queue_attr_t qosConcurrent = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_CONCURRENT, QOS_CLASS_USER_INITIATED, 0); - static void *processingQueueKey = "com.sdl.serialProcessing"; - static void *concurrentQueueKey = "com.sdl.concurrentProcessing"; - _sdlProcessingQueue = dispatch_queue_create("com.sdl.serialProcessing", qosSerial); - dispatch_queue_set_specific(_sdlProcessingQueue, processingQueueKey, (void *)processingQueueKey, NULL); - _sdlConcurrentQueue = dispatch_queue_create("com.sdl.concurrentProcessing", qosConcurrent); - dispatch_queue_set_specific(_sdlConcurrentQueue, concurrentQueueKey, (void *)concurrentQueueKey, NULL); + _sdlProcessingQueue = dispatch_queue_create(SDLProcessingQueueName, qosSerial); + dispatch_queue_set_specific(_sdlProcessingQueue, SDLProcessingQueueName, SDLProcessingQueueName, NULL); + _sdlConcurrentQueue = dispatch_queue_create(SDLConcurrentQueueName, qosConcurrent); + dispatch_queue_set_specific(_sdlConcurrentQueue, SDLConcurrentQueueName, SDLConcurrentQueueName, NULL); return self; } diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m index c5e4c48ee..5977ded75 100644 --- a/SmartDeviceLink/SDLLifecycleManager.m +++ b/SmartDeviceLink/SDLLifecycleManager.m @@ -739,7 +739,7 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask // this is to make sure that the transition happens on the dedicated queue - (void)sdl_runOnProcessingQueue:(void (^)(void))block { - if (dispatch_get_specific("com.sdl.serialProcessing") != nil) { + if (dispatch_get_specific(SDLProcessingQueueName) != nil) { block(); } else { dispatch_sync(self.lifecycleQueue, block); |