File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ module Unfork
33 -- * Asynchronous I/O
44 unforkAsyncVoidIO ,
55 unforkAsyncIO ,
6- Promise (.. ),
6+ Future (.. ),
77 -- * Asynchronous STM
88 unforkAsyncVoidSTM ,
99 unforkAsyncSTM ,
@@ -119,7 +119,7 @@ unforkAsyncSTM action =
119119unforkAsyncIO ::
120120 (task -> IO result )
121121 -- ^ Action that needs to be run serially
122- -> ((task -> IO (Promise result )) -> IO conclusion )
122+ -> ((task -> IO (Future result )) -> IO conclusion )
123123 -- ^ Continuation with a thread-safe version of the action
124124 -> IO conclusion
125125unforkAsyncIO action =
@@ -128,7 +128,7 @@ unforkAsyncIO action =
128128 threadSafeAction run arg = do
129129 resultVar <- newEmptyMVar
130130 atomically (enqueue run Task { arg, resultVar })
131- pure (Promise { block = readMVar resultVar, peek = tryReadMVar resultVar })
131+ pure (Future { await = readMVar resultVar, peek = tryReadMVar resultVar })
132132 step Task { arg, resultVar } = do
133133 b <- action arg
134134 putMVar resultVar b
@@ -188,7 +188,7 @@ data Task a b = Task{ arg :: !a, resultVar :: !b }
188188
189189data Run q = Run { queue :: ! (TQueue q ), stopper :: ! (TVar Bool ) }
190190
191- data Promise result = Promise { block :: IO result , peek :: IO (Maybe result ) }
191+ data Future result = Future { await :: IO result , peek :: IO (Maybe result ) }
192192
193193data Lock = Lock
194194
You can’t perform that action at this time.
0 commit comments