fix MVar infinite blocking

This commit is contained in:
Yann Esposito (Yogsototh) 2016-01-04 20:25:52 +01:00 committed by Nicolas Rolland
parent 2719a956d5
commit 59365116f3

View file

@ -62,7 +62,9 @@ performXhr xhr request = do
callback <- onReadyStateChange xhr $ do callback <- onReadyStateChange xhr $ do
state <- readyState xhr state <- readyState xhr
case state of case state of
4 -> putMVar waiter () 4 -> do
toPut <- isEmptyMVar waiter
when toPut (putMVar waiter ())
_ -> return () _ -> return ()
openXhr xhr (cs $ method request) (toUrl request) True openXhr xhr (cs $ method request) (toUrl request) True
setHeaders xhr (requestHeaders request) setHeaders xhr (requestHeaders request)