2014-02-11 19:22:08 +00:00
|
|
|
{- process ids
|
|
|
|
-
|
2015-01-21 16:50:09 +00:00
|
|
|
- Copyright 2014 Joey Hess <id@joeyh.name>
|
2014-02-11 19:22:08 +00:00
|
|
|
-
|
2014-05-10 14:01:27 +00:00
|
|
|
- License: BSD-2-clause
|
2014-02-11 19:22:08 +00:00
|
|
|
-}
|
|
|
|
|
|
|
|
{-# LANGUAGE CPP #-}
|
|
|
|
|
2019-11-21 19:38:06 +00:00
|
|
|
module Utility.PID (PID, getPID) where
|
2014-02-11 19:22:08 +00:00
|
|
|
|
|
|
|
#ifndef mingw32_HOST_OS
|
|
|
|
import System.Posix.Types (ProcessID)
|
|
|
|
import System.Posix.Process (getProcessID)
|
|
|
|
#else
|
2017-11-13 16:55:23 +00:00
|
|
|
import System.Win32.Process (ProcessId, getCurrentProcessId)
|
2014-02-11 19:22:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef mingw32_HOST_OS
|
|
|
|
type PID = ProcessID
|
|
|
|
#else
|
|
|
|
type PID = ProcessId
|
|
|
|
#endif
|
|
|
|
|
|
|
|
getPID :: IO PID
|
|
|
|
#ifndef mingw32_HOST_OS
|
|
|
|
getPID = getProcessID
|
|
|
|
#else
|
|
|
|
getPID = getCurrentProcessId
|
|
|
|
#endif
|