different PID types for Unix and Windows

Windows has a larger (unsigned) PID space, so cannot use the unix CInt
there.

Note that TransferInfo does not yet ever get the TransferPid populated,
as there is missing locking.
This commit is contained in:
Joey Hess 2013-12-10 23:32:10 -04:00
parent 2fd63f3cfa
commit ecd42aef8e
2 changed files with 20 additions and 8 deletions

View file

@ -260,13 +260,15 @@ cancelTransfer pause t = do
killproc pid = void $ tryIO $ do
#ifndef mingw32_HOST_OS
g <- getProcessGroupIDOf pid
void $ tryIO $ signalProcessGroup sigTERM g
let signal sig = void $ tryIO $ signalProcessGroup sig g
signal sigTERM
graceperiod
void $ tryIO $ signalProcessGroup sigKILL g
signal sigKILL
#else
void $ tryIO $ generateConsoleCtrlEvent cTRL_C_EVENT pid
let singnal sig = void $ tryIO $ generateConsoleCtrlEvent sig pid
signal cTRL_C_EVENT
graceperiod
void $ tryIO $ generateConsoleCtrlEvent cTRL_BREAK_EVENT pid
signal cTRL_BREAK_EVENT
#endif
graceperiod = threadDelay 50000 -- 0.05 second