   init(threadId: Int, pool: NonBlockingThreadPool<Environment>) {
     self.threadId = threadId
     self.pool = pool
+    self.totalThreadCount = pool.totalThreadCount
+    self.workerThreadCount = pool.totalThreadCount - pool.externalFastPathThreadCount
+    self.coprimes = pool.coprimes
+    self.queues = pool.queues
+    self.condition = pool.condition
     self.rng = PCGRandomNumberGenerator(state: UInt64(threadId))
   }
   let threadId: Int

      pool.condition.cancelWait()
      return nil
    }
    pool.condition.commitWait(threadId)
    _ = pool.blockedCountStorage.decrement()
    return nil
  }

  var cancelledStorage: AtomicUInt64
  var blockedCountStorage: AtomicUInt64
  var spinningState: AtomicUInt64
  let condition: NonblockingCondition<Environment>
  let waitingMutex: [Environment.ConditionMutex]  // TODO: modify condition to add per-thread wakeup
  let externalWaitingMutex: Environment.ConditionMutex
  var threads: [Environment.Thread]

  private let perThreadKey = Environment.ThreadLocalStorage.makeKey(
