mirror of
https://github.com/facebook/Haxl.git
synced 2025-01-08 10:48:30 +03:00
Change type of CompleteReq (#142)
Summary: Pull Request resolved: https://github.com/facebook/Haxl/pull/142 Change type of CompleteReq to accept a ResultVal rather than an Either. This prepares it for being used in the next diff, and should be a no-op as the transform happened before use anyway Reviewed By: josefs Differential Revision: D28964006 fbshipit-source-id: ddfb6fc1ca66363c38b70eaf48fe90d26fae657d
This commit is contained in:
parent
5c49986786
commit
b30c4ac85d
@ -155,7 +155,7 @@ stdResultVar ivar completions ref flags p =
|
||||
atomicallyOnBlocking
|
||||
(LogicBug (ReadingCompletionsFailedFetch (dataSourceName p))) $ do
|
||||
cs <- readTVar completions
|
||||
writeTVar completions (CompleteReq r ivar allocs : cs)
|
||||
writeTVar completions (CompleteReq (eitherToResult r) ivar allocs : cs)
|
||||
-- Decrement the counter as request has finished. Do this after updating the
|
||||
-- completions TVar so that if the scheduler is tracking what was being
|
||||
-- waited on it gets a consistent view.
|
||||
|
@ -633,7 +633,7 @@ eitherToResult (Left e) = ThrowHaxl e NilWrites
|
||||
-- the relevant computations.
|
||||
data CompleteReq u w
|
||||
= forall a . CompleteReq
|
||||
(Either SomeException a)
|
||||
(ResultVal a w)
|
||||
!(IVar u w a) -- IVar because the result is cached
|
||||
{-# UNPACK #-} !Int64 -- see Note [tracking allocation in child threads]
|
||||
|
||||
|
@ -195,7 +195,7 @@ runHaxlWithWrites env@Env{..} haxl = do
|
||||
-- pushed on the front of the completions list) and
|
||||
-- therefore overrides it.
|
||||
IVarEmpty cv -> do
|
||||
writeIORef cr (IVarFull (eitherToResult a))
|
||||
writeIORef cr (IVarFull a)
|
||||
return cv
|
||||
jobs <- mapM getComplete comps
|
||||
return (foldr appendJobList JobNil jobs)
|
||||
|
Loading…
Reference in New Issue
Block a user