@@ -145,7 +145,7 @@ public final class Store<State, Action> {
145145 private let reducer : ( inout State , Action ) -> Effect < Action , Never >
146146 private var bufferedActions : [ Action ] = [ ]
147147 #if DEBUG
148- private let mainQueueChecksEnabled : Bool
148+ private let mainThreadChecksEnabled : Bool
149149 #endif
150150
151151 /// Initializes a store from an initial state, a reducer, and an environment.
@@ -163,7 +163,7 @@ public final class Store<State, Action> {
163163 initialState: initialState,
164164 reducer: reducer,
165165 environment: environment,
166- mainQueueChecksEnabled : true
166+ mainThreadChecksEnabled : true
167167 )
168168 self . threadCheck ( status: . `init`)
169169 }
@@ -184,7 +184,7 @@ public final class Store<State, Action> {
184184 initialState: initialState,
185185 reducer: reducer,
186186 environment: environment,
187- mainQueueChecksEnabled : false
187+ mainThreadChecksEnabled : false
188188 )
189189 }
190190
@@ -434,7 +434,7 @@ public final class Store<State, Action> {
434434 @inline ( __always)
435435 private func threadCheck( status: ThreadCheckStatus ) {
436436 #if DEBUG
437- guard self . mainQueueChecksEnabled && !isMainQueue
437+ guard self . mainThreadChecksEnabled && !Thread . isMainThread
438438 else { return }
439439
440440 let message : String
@@ -476,7 +476,7 @@ public final class Store<State, Action> {
476476 thread, or create this store via " Store.unchecked " to disable the main thread checker.
477477 """
478478 }
479-
479+
480480 breakpoint (
481481 """
482482 ---
@@ -500,23 +500,13 @@ public final class Store<State, Action> {
500500 initialState: State ,
501501 reducer: Reducer < State , Action , Environment > ,
502502 environment: Environment ,
503- mainQueueChecksEnabled : Bool
503+ mainThreadChecksEnabled : Bool
504504 ) {
505505 self . state = initialState
506506 self . reducer = { state, action in reducer. run ( & state, action, environment) }
507507
508508 #if DEBUG
509- self . mainQueueChecksEnabled = mainQueueChecksEnabled
509+ self . mainThreadChecksEnabled = mainThreadChecksEnabled
510510 #endif
511511 }
512512}
513-
514- private let mainQueueKey = DispatchSpecificKey < UInt8 > ( )
515- private let mainQueueValue : UInt8 = 0
516- private var isMainQueue : Bool {
517- _ = setSpecific
518- return DispatchQueue . getSpecific ( key: mainQueueKey) == mainQueueValue
519- }
520- private var setSpecific : ( ) = {
521- DispatchQueue . main. setSpecific ( key: mainQueueKey, value: mainQueueValue)
522- } ( )
0 commit comments