Copyright | (c) Daniel Franke 2007 |
---|---|
License | BSD-style (see the file libraries/base/LICENSE) |
Maintainer | [email protected] |
Stability | experimental |
Portability | non-portable (requires POSIX) |
Safe Haskell | Safe |
Language | Haskell2010 |
POSIX named semaphore support.
- data OpenSemFlags = OpenSemFlags {
- semCreate :: Bool
- semExclusive :: Bool
- data Semaphore
- semOpen :: String -> OpenSemFlags -> FileMode -> Int -> IO Semaphore
- semUnlink :: String -> IO ()
- semWait :: Semaphore -> IO ()
- semTryWait :: Semaphore -> IO Bool
- semThreadWait :: Semaphore -> IO ()
- semPost :: Semaphore -> IO ()
- semGetValue :: Semaphore -> IO Int
Documentation
data OpenSemFlags Source #
OpenSemFlags | |
|
semOpen :: String -> OpenSemFlags -> FileMode -> Int -> IO Semaphore Source #
Open a named semaphore with the given name, flags, mode, and initial value.
semWait :: Semaphore -> IO () Source #
Lock the semaphore, blocking until it becomes available. Since this is done through a system call, this will block the *entire runtime*, not just the current thread. If this is not the behaviour you want, use semThreadWait instead.
semTryWait :: Semaphore -> IO Bool Source #
Attempt to lock the semaphore without blocking. Immediately return False if it is not available.
semThreadWait :: Semaphore -> IO () Source #
Poll the semaphore until it is available, then lock it. Unlike semWait, this will block only the current thread rather than the entire process.