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