summaryrefslogtreecommitdiff
path: root/Assistant/TransferSlots.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-11-12 14:54:02 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-11-12 17:22:34 -0400
commitd03bfb7355d11e271664d4dea51449f8f5059780 (patch)
tree638b735821c6074f31e8556f71d7f6b1f04eb1dd /Assistant/TransferSlots.hs
parentf869020577d759313494828d1973adcf2916b392 (diff)
build assistant and watcher on windows (doesn't work yet)
Diffstat (limited to 'Assistant/TransferSlots.hs')
-rw-r--r--Assistant/TransferSlots.hs15
1 files changed, 12 insertions, 3 deletions
diff --git a/Assistant/TransferSlots.hs b/Assistant/TransferSlots.hs
index 36d557c3d..cb66e845a 100644
--- a/Assistant/TransferSlots.hs
+++ b/Assistant/TransferSlots.hs
@@ -5,6 +5,8 @@
- Licensed under the GNU GPL version 3 or higher.
-}
+{-# LANGUAGE CPP #-}
+
module Assistant.TransferSlots where
import Assistant.Common
@@ -32,8 +34,10 @@ import qualified Data.Map as M
import qualified Control.Exception as E
import Control.Concurrent
import qualified Control.Concurrent.MSemN as MSemN
-import System.Posix.Signals (signalProcessGroup, sigTERM, sigKILL)
+#ifndef mingw32_HOST_OS
import System.Posix.Process (getProcessGroupIDOf)
+import System.Posix.Signals (signalProcessGroup, sigTERM, sigKILL)
+#endif
type TransferGenerator = Assistant (Maybe (Transfer, TransferInfo, Transferrer -> Assistant ()))
@@ -247,13 +251,18 @@ cancelTransfer pause t = do
signalthread tid
| pause = throwTo tid PauseTransfer
| otherwise = killThread tid
- {- In order to stop helper processes like rsync,
- - kill the whole process group of the process running the transfer. -}
killproc pid = void $ tryIO $ do
+#ifndef mingw32_HOST_OS
+ {- In order to stop helper processes like rsync,
+ - kill the whole process group of the process
+ - running the transfer. -}
g <- getProcessGroupIDOf pid
void $ tryIO $ signalProcessGroup sigTERM g
threadDelay 50000 -- 0.05 second grace period
void $ tryIO $ signalProcessGroup sigKILL g
+#else
+ error "TODO: cancelTransfer not implemented on Windows"
+#endif
{- Start or resume a transfer. -}
startTransfer :: Transfer -> Assistant ()