Hoogle Search
Within LTS Haskell 24.68 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
ThreadKilled :: AsyncExceptionprotolude Protolude This exception is raised by another thread calling killThread, or by the system if it needs to terminate the thread for some reason.
isCurrentThreadBound :: IO Boolprotolude Protolude Returns True if the calling thread is bound, that is, if it is safe to use foreign libraries that rely on thread-local state from the calling thread.
killThread :: ThreadId -> IO ()protolude Protolude killThread raises the ThreadKilled exception in the given thread (GHC only).
killThread tid = throwTo tid ThreadKilled
mkWeakThreadId :: ThreadId -> IO (Weak ThreadId)protolude Protolude Make a weak pointer to a ThreadId. It can be important to do this if you want to hold a reference to a ThreadId while still allowing the thread to receive the BlockedIndefinitely family of exceptions (e.g. BlockedIndefinitelyOnMVar). Holding a normal ThreadId reference will prevent the delivery of BlockedIndefinitely exceptions because the reference could be used as the target of throwTo at any time, which would unblock the thread. Holding a Weak ThreadId, on the other hand, will not prevent the thread from receiving BlockedIndefinitely exceptions. It is still possible to throw an exception to a Weak ThreadId, but the caller must use deRefWeak first to determine whether the thread still exists.
-
protolude Protolude Returns the ThreadId of the calling thread (GHC only).
rtsSupportsBoundThreads :: Boolprotolude Protolude True if bound threads are supported. If rtsSupportsBoundThreads is False, isCurrentThreadBound will always return False and both forkOS and runInBoundThread will fail.
runInBoundThread :: IO a -> IO aprotolude Protolude Run the IO computation passed as the first argument. If the calling thread is not bound, a bound thread is created temporarily. runInBoundThread doesn't finish until the IO computation finishes. You can wrap a series of foreign function calls that rely on thread-local state with runInBoundThread so that you can use them without knowing whether the current thread is bound.
runInUnboundThread :: IO a -> IO aprotolude Protolude Run the IO computation passed as the first argument. If the calling thread is bound, an unbound thread is created temporarily using forkIO. runInBoundThread doesn't finish until the IO computation finishes. Use this function only in the rare case that you have actually observed a performance loss due to the use of bound threads. A program that doesn't need its main thread to be bound and makes heavy use of concurrency (e.g. a web server), might want to wrap its main action in runInUnboundThread. Note that exceptions which are thrown to the current thread are thrown in turn to the thread that is executing the given computation. This ensures there's always a way of killing the forked thread.
runReader :: Reader r a -> r -> aprotolude Protolude Runs a Reader and extracts the final value from it. (The inverse of reader.)
runReaderT :: ReaderT r (m :: Type -> Type) a -> r -> m aprotolude Protolude No documentation available.