Skip to content

Commit c769196

Browse files
Create dispatch queues in the Darwin framework more consistently.
* Use a common prefix for all the queue labels ("com.csa-iot.matter.framework"). * Use DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL for all the queues. * Use a common suffix ("workqueue") for all work queues.
1 parent d1c9050 commit c769196

7 files changed

+14
-8
lines changed

src/darwin/Framework/CHIP/MTRDevice.mm

+2-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ - (instancetype)initWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceControlle
162162
_nodeID = [nodeID copy];
163163
_fabricIndex = controller.fabricIndex;
164164
_deviceController = controller;
165-
_queue = dispatch_queue_create("com.apple.matter.framework.device.workqueue", DISPATCH_QUEUE_SERIAL);
165+
_queue
166+
= dispatch_queue_create("com.csa-iot.matter.framework.device.workqueue", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL);
166167
_readCache = [NSMutableDictionary dictionary];
167168
_expectedValueCache = [NSMutableDictionary dictionary];
168169
_asyncCallbackWorkQueue = [[MTRAsyncCallbackWorkQueue alloc] initWithContext:self queue:_queue];

src/darwin/Framework/CHIP/MTRDeviceAttestationDelegateBridge.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ class MTRDeviceAttestationDelegateBridge : public chip::Credentials::DeviceAttes
3333
: mResult(chip::Credentials::AttestationVerificationResult::kSuccess)
3434
, mDeviceController(deviceController)
3535
, mDeviceAttestationDelegate(deviceAttestationDelegate)
36-
, mQueue(dispatch_queue_create("com.csa.matter.framework.device_attestation.workqueue", DISPATCH_QUEUE_SERIAL))
36+
, mQueue(dispatch_queue_create(
37+
"com.csa-iot.matter.framework.device_attestation.workqueue", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL))
3738
, mExpiryTimeoutSecs(expiryTimeoutSecs)
3839
, mShouldWaitAfterDeviceAttestation(shouldWaitAfterDeviceAttestation)
3940
{

src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.mm

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
static void SetupXPCQueue(void)
3232
{
3333
dispatch_once(&workQueueInitOnceToken, ^{
34-
globalWorkQueue = dispatch_queue_create("com.apple.matter.framework.xpc.workqueue", DISPATCH_QUEUE_SERIAL);
34+
globalWorkQueue
35+
= dispatch_queue_create("com.csa-iot.matter.framework.xpc.workqueue", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL);
3536
});
3637
}
3738

src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm

+2-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,8 @@ void ResetState()
419419

420420
MTROTAProviderDelegateBridge::MTROTAProviderDelegateBridge(id<MTROTAProviderDelegate> delegate)
421421
: mDelegate(delegate)
422-
, mDelegateNotificationQueue(dispatch_queue_create("com.csa.matter.framework.otaprovider.workqueue", DISPATCH_QUEUE_SERIAL))
422+
, mDelegateNotificationQueue(
423+
dispatch_queue_create("com.csa-iot.matter.framework.otaprovider.workqueue", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL))
423424
{
424425
gOtaSender.SetDelegate(delegate, mDelegateNotificationQueue);
425426
Clusters::OTAProvider::SetDelegate(kOtaProviderEndpoint, this);

src/darwin/Framework/CHIP/MTRPersistentStorageDelegateBridge.mm

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424
MTRPersistentStorageDelegateBridge::MTRPersistentStorageDelegateBridge(id<MTRStorage> delegate)
2525
: mDelegate(delegate)
26-
, mWorkQueue(dispatch_queue_create("com.csa.matter.framework.storage.workqueue", DISPATCH_QUEUE_SERIAL))
26+
, mWorkQueue(
27+
dispatch_queue_create("com.csa-iot.matter.framework.storage.workqueue", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL))
2728
{
2829
}
2930

src/platform/Darwin/BleConnectionDelegateImpl.mm

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ - (id)initWithDiscriminator:(const chip::SetupDiscriminator &)deviceDiscriminato
104104
if (self) {
105105
self.shortServiceUUID = [UUIDHelper GetShortestServiceUUID:&chip::Ble::CHIP_BLE_SVC_ID];
106106
_deviceDiscriminator = deviceDiscriminator;
107-
_workQueue = dispatch_queue_create("com.chip.ble.work_queue", DISPATCH_QUEUE_SERIAL);
107+
_workQueue
108+
= dispatch_queue_create("com.csa-iot.matter.framework.ble.workqueue", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL);
108109
_chipWorkQueue = chip::DeviceLayer::PlatformMgrImpl().GetWorkQueue();
109110
_timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, _workQueue);
110111
_centralManager = [CBCentralManager alloc];

src/platform/Darwin/PlatformManagerImpl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <dispatch/dispatch.h>
2727
#include <platform/internal/GenericPlatformManagerImpl.h>
2828

29-
static constexpr const char * const CHIP_CONTROLLER_QUEUE = "com.csa.matter.framework.controller.workqueue";
29+
static constexpr const char * const CHIP_CONTROLLER_QUEUE = "com.csa-iot.matter.framework.controller.workqueue";
3030

3131
namespace chip {
3232
namespace DeviceLayer {
@@ -47,7 +47,7 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener
4747
{
4848
if (mWorkQueue == nullptr)
4949
{
50-
mWorkQueue = dispatch_queue_create(CHIP_CONTROLLER_QUEUE, DISPATCH_QUEUE_SERIAL);
50+
mWorkQueue = dispatch_queue_create(CHIP_CONTROLLER_QUEUE, DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL);
5151
dispatch_suspend(mWorkQueue);
5252
mIsWorkQueueSuspended = true;
5353
}

0 commit comments

Comments
 (0)