{-# LANGUAGE CPP #-}
module Colog.Concurrent.Internal
( BackgroundWorker (..)
, Capacity (..)
) where
import Control.Concurrent (ThreadId)
import Control.Concurrent.STM (STM, TVar)
import Numeric.Natural (Natural)
#if MIN_VERSION_stm(2,5,0)
newtype Capacity = Capacity Natural
#else
newtype Capacity = Capacity Int
#endif
data BackgroundWorker msg = BackgroundWorker
{ BackgroundWorker msg -> ThreadId
backgroundWorkerThreadId :: !ThreadId
, BackgroundWorker msg -> msg -> STM ()
backgroundWorkerWrite :: msg -> STM ()
, BackgroundWorker msg -> TVar Bool
backgroundWorkerIsAlive :: TVar Bool
}