on master help sign in
rename variable
commit3946e8f06224d3f95e2a888e515a576f05fb7877 authorHarendra Kumar <harendra.kumar@gmail.com> dateSun 3 Sep 2017, 16:25 (9 years ago) parenta0d9419
1 file changed+6−6
src/Asyncly/AsyncT.hs+6−6
src/Asyncly/AsyncT.hs+6−6
@@ -97,7 +97,7 @@ data ChildEvent a =
9797 -- exceptions or using atomicModify
9898data Context m a =
9999 Context { outputQueue :: IORef [ChildEvent a]
100− , synchOutQ :: MVar Bool -- wakeup mechanism for outQ
100+ , doorBell :: MVar Bool -- wakeup mechanism for outQ
101101 , enqueue :: AsyncT m a -> IO ()
102102 , runqueue :: m ()
103103 , runningThreads :: IORef (Set ThreadId)
@@ -219,7 +219,7 @@ send ctx msg = liftIO $ do
219219 atomicModifyIORefCAS_ (outputQueue ctx) $ \es -> msg : es
220220 -- XXX need a memory barrier? The wake up must happen only after the
221221 -- store has finished otherwise we can have lost wakeup problems.
222− void $ tryPutMVar (synchOutQ ctx) True
222+ void $ tryPutMVar (doorBell ctx) True
223223
224224{-# INLINE sendStop #-}
225225sendStop :: MonadIO m => Context m a -> m ()
@@ -319,13 +319,13 @@ sendWorkerWait ctx = do
319319 -- sending a worker in a loop running into a livelock
320320 done <- queueEmpty ctx
321321 when (not done) (pushWorker ctx)
322− void $ liftIO $ takeMVar (synchOutQ ctx)
322+ void $ liftIO $ takeMVar (doorBell ctx)
323323
324324-- Note: This is performance sensitive code.
325325{-# NOINLINE pullWorker #-}
326326pullWorker :: MonadAsync m => Context m a -> AsyncT m a
327327pullWorker ctx = AsyncT $ \pctx stp yld -> do
328− res <- liftIO $ tryTakeMVar (synchOutQ ctx)
328+ res <- liftIO $ tryTakeMVar (doorBell ctx)
329329 when (isNothing res) $ sendWorkerWait ctx
330330 list <- liftIO $ atomicModifyIORefCAS (outputQueue ctx) $ \x -> ([], x)
331331 (runAsyncT $ processEvents list) pctx stp yld
@@ -377,7 +377,7 @@ pullFork m1 m2 fifo = AsyncT $ \_ stp yld -> do
377377 pushL q m1 >> pushL q m2
378378 let ctx =
379379 Context { outputQueue = outQ
380− , synchOutQ = outQMv
380+ , doorBell = outQMv
381381 , runningThreads = running
382382 , runqueue = runqueueFIFO ctx q
383383 , enqueue = pushL q
@@ -390,7 +390,7 @@ pullFork m1 m2 fifo = AsyncT $ \_ stp yld -> do
390390 let checkEmpty = liftIO (readIORef q) >>= return . null
391391 let ctx =
392392 Context { outputQueue = outQ
393− , synchOutQ = outQMv
393+ , doorBell = outQMv
394394 , runningThreads = running
395395 , runqueue = runqueueLIFO ctx q
396396 , enqueue = enqueueLIFO q