Skip to content

Commit

Permalink
Document units of measure for timeout (fixes #340)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentRDC committed Sep 4, 2024
1 parent 61bbd12 commit 8fee6bf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/distributed-process/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Unreleased

* Added documentation on the unit of measurement for timeout durations (#340)

2024-09-03 Laurent P. René de Cotret <[email protected]> 0.7.7

* Bumped dependency bounds to support GHC 8.10.7 - GHC 9.10.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ enqueueSTM (CQueue _arrived incoming size) !a = do
data BlockSpec =
NonBlocking
| Blocking
| Timeout Int
| Timeout Int -- ^ Timeout in microseconds

-- Match operations
--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,9 @@ receiveWait ms = do
-- If the timeout is zero do a non-blocking check for matching messages. A
-- non-zero timeout is applied only when waiting for incoming messages (that is,
-- /after/ we have checked the messages that are already in the mailbox).
receiveTimeout :: Int -> [Match b] -> Process (Maybe b)
receiveTimeout :: Int -- ^ Timeout in microseconds
-> [Match b]
-> Process (Maybe b)
receiveTimeout t ms = do
queue <- processQueue <$> ask
let blockSpec = if t == 0 then NonBlocking else Timeout t
Expand Down Expand Up @@ -1020,7 +1022,9 @@ catchesHandler handlers e = foldr tryHandler (throwM e) handlers
--------------------------------------------------------------------------------

-- | Like 'expect' but with a timeout
expectTimeout :: forall a. Serializable a => Int -> Process (Maybe a)
expectTimeout :: forall a. Serializable a
=> Int -- ^ Timeout in microseconds
-> Process (Maybe a)
expectTimeout n = receiveTimeout n [match return]

-- | Asynchronous version of 'spawn'
Expand Down

0 comments on commit 8fee6bf

Please sign in to comment.