@@ -136,7 +136,7 @@ public final class Store<State, Action> {
136136 private let reducer : ( inout State , Action ) -> Effect < Action , Never >
137137 var state : CurrentValueSubject < State , Never >
138138 #if DEBUG
139- private let mainQueueChecksEnabled : Bool
139+ private let mainThreadChecksEnabled : Bool
140140 #endif
141141
142142 /// Initializes a store from an initial state, a reducer, and an environment.
@@ -154,7 +154,7 @@ public final class Store<State, Action> {
154154 initialState: initialState,
155155 reducer: reducer,
156156 environment: environment,
157- mainQueueChecksEnabled : true
157+ mainThreadChecksEnabled : true
158158 )
159159 self . threadCheck ( status: . `init`)
160160 }
@@ -175,7 +175,7 @@ public final class Store<State, Action> {
175175 initialState: initialState,
176176 reducer: reducer,
177177 environment: environment,
178- mainQueueChecksEnabled : false
178+ mainThreadChecksEnabled : false
179179 )
180180 }
181181
@@ -411,7 +411,7 @@ public final class Store<State, Action> {
411411 @inline ( __always)
412412 private func threadCheck( status: ThreadCheckStatus ) {
413413 #if DEBUG
414- guard self . mainQueueChecksEnabled && !isMainQueue
414+ guard self . mainThreadChecksEnabled && !Thread . isMainThread
415415 else { return }
416416
417417 let message : String
@@ -477,23 +477,13 @@ public final class Store<State, Action> {
477477 initialState: State ,
478478 reducer: Reducer < State , Action , Environment > ,
479479 environment: Environment ,
480- mainQueueChecksEnabled : Bool
480+ mainThreadChecksEnabled : Bool
481481 ) {
482482 self . state = CurrentValueSubject ( initialState)
483483 self . reducer = { state, action in reducer. run ( & state, action, environment) }
484484
485485 #if DEBUG
486- self . mainQueueChecksEnabled = mainQueueChecksEnabled
486+ self . mainThreadChecksEnabled = mainThreadChecksEnabled
487487 #endif
488488 }
489489}
490-
491- private let mainQueueKey = DispatchSpecificKey < UInt8 > ( )
492- private let mainQueueValue : UInt8 = 0
493- private var isMainQueue : Bool {
494- _ = setSpecific
495- return DispatchQueue . getSpecific ( key: mainQueueKey) == mainQueueValue
496- }
497- private var setSpecific : ( ) = {
498- DispatchQueue . main. setSpecific ( key: mainQueueKey, value: mainQueueValue)
499- } ( )
0 commit comments