File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -239,7 +239,7 @@ extension Interpose {
239239
240240 // Immediately try to execute task. If not there, install waiter.
241241 if try tryExecute ( ) == false {
242- InterposeWatcher . globalWatchers . append ( self )
242+ InterposeWatcher . append ( waiter : self )
243243 }
244244 }
245245
@@ -257,12 +257,18 @@ extension Interpose {
257257// dyld C function cannot capture class context so we pack it in a static struct.
258258private struct InterposeWatcher {
259259 // Global list of waiters; can be multiple per class
260- fileprivate static var globalWatchers : [ Interpose . Waiter ] = {
260+ private static var globalWatchers : [ Interpose . Waiter ] = {
261261 // Register after Swift global registers to not deadlock
262262 DispatchQueue . main. async { InterposeWatcher . installGlobalImageLoadWatcher ( ) }
263263 return [ ]
264264 } ( )
265265
266+ fileprivate static func append( waiter: Interpose . Waiter ) {
267+ InterposeWatcher . globalWatcherQueue. sync {
268+ globalWatchers. append ( waiter)
269+ }
270+ }
271+
266272 // Register hook when dyld loads an image
267273 private static let globalWatcherQueue = DispatchQueue ( label: " com.steipete.global-image-watcher " )
268274 private static func installGlobalImageLoadWatcher( ) {
You can’t perform that action at this time.
0 commit comments