diff options
author | Joey Hess <joey@kitenet.net> | 2012-07-25 12:07:30 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-07-25 12:07:30 -0400 |
commit | 6107328a6b981ec8130e4154be1ebe7bc11979df (patch) | |
tree | 8006e022a2f4896d643720d8c366aa0f2bf399a2 /Assistant/TransferSlots.hs | |
parent | 522f568450a005ae81b24f63bb37e75320b51219 (diff) |
avoid spawning new transfer thread until a slot becomes available
Diffstat (limited to 'Assistant/TransferSlots.hs')
-rw-r--r-- | Assistant/TransferSlots.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Assistant/TransferSlots.hs b/Assistant/TransferSlots.hs index dc077254d..710a18884 100644 --- a/Assistant/TransferSlots.hs +++ b/Assistant/TransferSlots.hs @@ -29,9 +29,10 @@ newTransferSlots = newQSemN numSlots {- Waits until a transfer slot becomes available, and runs a transfer - action in the slot, in its own thread. -} inTransferSlot :: TransferSlots -> ThreadState -> Annex a -> IO ThreadId -inTransferSlot s st a = forkIO $ bracket_ start done run +inTransferSlot s st a = do + waitQSemN s 1 + forkIO $ bracket_ noop done run where - start = waitQSemN s 1 done = transferComplete s run = unsafeRunThreadState st a |