Skip to content

Commit fe915a2

Browse files
Address review comments.
1 parent 1e40af0 commit fe915a2

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ NS_ASSUME_NONNULL_BEGIN
2424
* A representation of an attribute implemented on a server cluster by an
2525
* MTRDeviceController. An attribute has an identifier and a value, and may or
2626
* may not be writable.
27+
*
28+
* MTRServerAttribute's API can be accessed from any thread.
2729
*/
2830
NS_SWIFT_SENDABLE
2931
MTR_NEWLY_AVAILABLE
@@ -51,13 +53,13 @@ MTR_NEWLY_AVAILABLE
5153
*/
5254
- (BOOL)setValue:(NSDictionary<NSString *, id> *)value;
5355

54-
@property (nonatomic, copy, readonly) NSNumber * attributeID;
55-
@property (nonatomic, copy, readonly) NSDictionary<NSString *, id> * value;
56+
@property (atomic, copy, readonly) NSNumber * attributeID;
57+
@property (atomic, copy, readonly) NSDictionary<NSString *, id> * value;
5658
/**
5759
* The privilege level necessary to read this attribute.
5860
*/
59-
@property (nonatomic, assign, readonly) MTRAccessControlEntryPrivilege requiredReadPrivilege;
60-
@property (nonatomic, assign, readonly, getter=isWritable) BOOL writable;
61+
@property (atomic, assign, readonly) MTRAccessControlEntryPrivilege requiredReadPrivilege;
62+
@property (atomic, assign, readonly, getter=isWritable) BOOL writable;
6163

6264
@end
6365

src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
2323

2424
/**
2525
* A representation of a server cluster implemented by an MTRDeviceController.
26+
*
27+
* MTRServerCluster's API can be accessed from any thread.
2628
*/
2729
NS_SWIFT_SENDABLE
2830
MTR_NEWLY_AVAILABLE
@@ -90,22 +92,22 @@ MTR_NEWLY_AVAILABLE
9092
*/
9193
+ (MTRServerCluster *)newDescriptorCluster;
9294

93-
@property (nonatomic, copy, readonly) NSNumber * clusterID;
95+
@property (atomic, copy, readonly) NSNumber * clusterID;
9496

95-
@property (nonatomic, copy, readonly) NSNumber * clusterRevision;
97+
@property (atomic, copy, readonly) NSNumber * clusterRevision;
9698

9799
/**
98100
* The list of entities that are allowed to access this cluster instance. This
99101
* list is in addition to any endpoint-wide access grants that exist.
100102
*
101103
* Defaults to empty list, which means no additional access grants.
102104
*/
103-
@property (nonatomic, copy, readonly) NSArray<MTRAccessGrant *> * accessGrants;
105+
@property (atomic, copy, readonly) NSArray<MTRAccessGrant *> * accessGrants;
104106

105107
/**
106108
* The list of attributes supported by the cluster.
107109
*/
108-
@property (nonatomic, copy, readonly) NSArray<MTRServerAttribute *> * attributes;
110+
@property (atomic, copy, readonly) NSArray<MTRServerAttribute *> * attributes;
109111

110112
@end
111113

src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster.mm

+2-4
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,8 @@ @implementation MTRServerCluster {
8888
NSArray<NSNumber *> * _generatedCommands;
8989

9090
/**
91-
* _lock always protects access to: _accessGrants, _attributes,
92-
* _deviceController, _attributeAccessInterface, _matterAttributeMetadata,
93-
* _matterAccessGrants, _parentEndpoint, _acceptedCommands,
94-
* _generatedCommands, _matterAcceptedCommandList, _matterGeneratedCommandList.
91+
* _lock always protects access to all our mutable ivars (the ones that are
92+
* modified after init).
9593
*/
9694
os_unfair_lock _lock;
9795
}

src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster_Internal.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -66,37 +66,37 @@ NS_ASSUME_NONNULL_BEGIN
6666
* The access grants the Matter stack can observe. Only modified while
6767
* associating with a controller or on the Matter queue.
6868
*/
69-
@property (nonatomic, copy, readonly) NSArray<MTRAccessGrant *> * matterAccessGrants;
69+
@property (atomic, copy, readonly) NSArray<MTRAccessGrant *> * matterAccessGrants;
7070

7171
/**
7272
* parentEndpoint will be kInvalidEndpointId until the cluster is added to an endpoint.
7373
*/
74-
@property (nonatomic, assign, readonly) chip::EndpointId parentEndpoint;
74+
@property (atomic, assign, readonly) chip::EndpointId parentEndpoint;
7575

7676
/**
7777
* The attribute metadata for the cluster. Only valid after associateWithController: has succeeded.
7878
*/
79-
@property (nonatomic, assign, readonly) chip::Span<const EmberAfAttributeMetadata> matterAttributeMetadata;
79+
@property (atomic, assign, readonly) chip::Span<const EmberAfAttributeMetadata> matterAttributeMetadata;
8080

8181
/**
8282
* The list of accepted command IDs.
8383
*/
84-
@property (nonatomic, copy, nullable) NSArray<NSNumber *> * acceptedCommands;
84+
@property (atomic, copy, nullable) NSArray<NSNumber *> * acceptedCommands;
8585

8686
/**
8787
* The list of generated command IDs.
8888
*/
89-
@property (nonatomic, copy, nullable) NSArray<NSNumber *> * generatedCommands;
89+
@property (atomic, copy, nullable) NSArray<NSNumber *> * generatedCommands;
9090

9191
/**
9292
* The list of accepted commands IDs in the format the Matter stack needs.
9393
*/
94-
@property (nonatomic, assign, nullable, readonly) chip::CommandId * matterAcceptedCommands;
94+
@property (atomic, assign, nullable, readonly) chip::CommandId * matterAcceptedCommands;
9595

9696
/**
9797
* The list of generated commands IDs in the format the Matter stack needs.
9898
*/
99-
@property (nonatomic, assign, nullable, readonly) chip::CommandId * matterGeneratedCommands;
99+
@property (atomic, assign, nullable, readonly) chip::CommandId * matterGeneratedCommands;
100100

101101
@end
102102

0 commit comments

Comments
 (0)