| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
System.Posix.Thread
Description
Bindings to the POSIX threads library.
Requires linking with the -threaded RTS.
- create :: IO (Ptr a) -> IO ThreadId
- create_ :: IO () -> IO ThreadId
- createWithAttributes :: AttributesMonoid -> IO (Ptr a) -> IO ThreadId
- createWithAttributes_ :: AttributesMonoid -> IO () -> IO ThreadId
- exit :: Ptr a -> IO ()
- exit_ :: IO ()
- cancel :: ThreadId -> IO ()
- join :: ThreadId -> IO (Ptr a)
- detach :: ThreadId -> IO ()
- myThreadId :: IO ThreadId
- data Attributes = Attributes {
- detachState :: DetachState
- guardSize :: CSize
- inheritSched :: InheritSched
- schedParam :: SchedParam
- schedPolicy :: SchedPolicy
- scope :: Scope
- stack :: Ptr ()
- stackSize :: CSize
- data AttributesMonoid = AttributesMonoid {
- detachState :: First DetachState
- guardSize :: First CSize
- inheritSched :: First InheritSched
- schedParam :: First SchedParam
- schedPolicy :: First SchedPolicy
- scope :: First Scope
- stack :: First (Ptr ())
- stackSize :: First CSize
- data Key
- createKey :: FunPtr (Ptr a -> IO ()) -> IO Key
- createKey_ :: IO Key
- deleteKey :: Key -> IO ()
- setSpecific :: Key -> Ptr a -> IO ()
- getSpecific :: Key -> IO (Ptr a)
Threads
Arguments
| :: AttributesMonoid | |
| -> IO (Ptr a) | Created thread runs this IO computation. |
| -> IO ThreadId |
Create a new thread.
createWithAttributes_ :: AttributesMonoid -> IO () -> IO ThreadId #
Like createWithAttributes, but with an IO computation that returns
nothing.
myThreadId :: IO ThreadId #
Obtain ID of the calling thread.
Attributes
data Attributes #
Thread attributes.
Constructors
| Attributes | |
Fields
| |
Instances
data AttributesMonoid #
Partial set of thread attributes. Think of it as a diff to apply to the default attributes object.
Constructors
| AttributesMonoid | |
Fields
| |
Instances
Thread local storage
Opaque objects used to locate thread-specific data.
createKey_ :: IO Key #
Like createKey, but with no finalizer.
setSpecific :: Key -> Ptr a -> IO () #
Associate a thread-specific value with a key obtained via a previous
call to createKey.
getSpecific :: Key -> IO (Ptr a) #
Return the value currently bound to the specified key on behalf of the calling thread.