System.PosixCompat.Unistd

unix-compat-0.3.0.1: Portable POSIX-compatibility layer.

Safe Haskell | Safe-Infered

System.PosixCompat.Unistd

Contents

- System environment
- Sleeping

Description

This module makes the operations exported by `System.Posix.Unistd` available on all platforms. On POSIX systems it re-exports operations from `System.Posix.Unistd`, on other platforms it emulates the operations as far as possible.

Synopsis

- data SystemID = SystemID {
  - systemName :: String
  - nodeName :: String
  - release :: String
  - version :: String
  - machine :: String
  }
- getSystemID :: IO SystemID
- sleep :: Int -> IO Int
- usleep :: Int -> IO ()
- nanosleep :: Integer -> IO ()

# System environment

data SystemID

Constructors

SystemID |
Fields systemName :: String nodeName :: String release :: String version :: String machine :: String

getSystemID :: IO SystemID

# Sleeping

sleep :: Int -> IO Int

Sleep for the specified duration (in seconds). Returns the time remaining (if the sleep was interrupted by a signal, for example).

GHC Note: the comment for `usleep` also applies here.

usleep :: Int -> IO ()

Sleep for the specified duration (in microseconds).

GHC Note: `threadDelay` is a better choice. Without the `-threaded` option, `usleep` will block all other user threads. Even with the `-threaded` option, `usleep` requires a full OS thread to itself. `threadDelay` has neither of these shortcomings.

nanosleep :: Integer -> IO ()

Sleep for the specified duration (in nanoseconds)