{-# OPTIONS_HADDOCK not-home #-} module UnliftIO.Reaper.Internal (Reaper (..)) where -- | A data structure to hold reaper APIs. data Reaper m workload item = Reaper { forall (m :: * -> *) workload item. Reaper m workload item -> item -> m () reaperAdd :: item -> m () -- ^ Adding an item to the workload , forall (m :: * -> *) workload item. Reaper m workload item -> m workload reaperRead :: m workload -- ^ Reading workload. , forall (m :: * -> *) workload item. Reaper m workload item -> (workload -> workload) -> m workload reaperModify :: (workload -> workload) -> m workload -- ^ Modify the workload. The resulting workload is returned. -- -- If there is no reaper thread, the modifier will not be applied and -- 'UnliftIO.Reaper.reaperEmpty' will be returned. -- -- If the reaper is currently executing jobs, those jobs will not be in -- the given workload and the workload might appear empty. -- -- If all jobs are removed by the modifier, the reaper thread will not be -- killed. The reaper thread will only terminate if 'reaperKill' is called -- or the result of 'UnliftIO.Reaper.reaperAction' satisfies 'UnliftIO.Reaper.reaperNull'. -- -- @since 0.1.0 , forall (m :: * -> *) workload item. Reaper m workload item -> m workload reaperStop :: m workload -- ^ Stopping the reaper thread if exists. -- The current workload is returned. , forall (m :: * -> *) workload item. Reaper m workload item -> m () reaperKill :: m () -- ^ Killing the reaper thread immediately if exists. }