You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,6 +70,18 @@ The `Public…` classes all follow the same pattern and are not very interesting
70
70
71
71
`ObjectLifetimesTests.swift` contains tests of the behaviour described in this section.
72
72
73
+
### Threading
74
+
75
+
Since this is an extension of ably-cocoa, we follow the same threading approach:
76
+
77
+
1. The public API can be interacted with from any thread, including synchronous methods such as getters
78
+
2. Callbacks passed to the public API are invoked on the same queue as used by the `ARTRealtime` instance (the `dispatchQueue` client option)
79
+
3. Synchronisation of mutable state is performed using the same internal serial dispatch queue as is used by the `ARTRealtime` instance (the `internalDispatchQueue` client option)
80
+
81
+
We follow the same naming convention as in ably-cocoa whereby if a method's name contains `nosync` then it must be called on the internal dispatch queue. This allows us to avoid deadlocks that would result from attempting to call `DispatchQueue.sync { … }` when already on the internal queue.
82
+
83
+
We have an extension on `DispatchQueue`, `ably_syncNoDeadlock(execute:)`, which behaves the same as `sync(execute:)` but with a runtime precondition that we are not already on the queue; favour our extension in order to avoid deadlock.
fatalError("To access LiveObjects functionality, you must pass the LiveObjects plugin in the client options when creating the ARTRealtime instance: `clientOptions.plugins = [.liveObjects: AblyLiveObjects.Plugin.self]`")
28
28
}
@@ -34,25 +34,27 @@ internal final class DefaultInternalPlugin: NSObject, _AblyPluginSupportPrivate.
0 commit comments