What does the withProcessHandle_ function do?

I want to learn how to use FFI with Win32, so I'm looking through the GHC source code. I encountered the function terminateProcess :: ProcessHandle -> IO () terminateProcess ph = do withProcessHandle_ ph $ \p_ -> case p_ of ClosedHandle _ -> return p_ OpenHandle h -> do throwErrnoIfMinus1_ "terminateProcess" $ c_terminateProcess h return p_ which uses withProcessHandle_. What does it do? Thanks -John

John Ky wrote:
I want to learn how to use FFI with Win32, so I'm looking through the GHC source code. I encountered the function
terminateProcess :: ProcessHandle -> IO () terminateProcess ph = do withProcessHandle_ ph $ \p_ -> case p_ of ClosedHandle _ -> return p_ OpenHandle h -> do throwErrnoIfMinus1_ "terminateProcess" $ c_terminateProcess h return p_
which uses withProcessHandle_. What does it do?
withProcessHandle_ is defined in System.Process.Internals. http://darcs.haskell.org/packages/base/System/Process/Internals.hs Cheers, Simon
participants (2)
-
John Ky
-
Simon Marlow