Client refactor: Remove usage of Lwt_unix from Lwt_dropbox

This commit is contained in:
Grégoire Henry 2018-02-08 10:51:01 +01:00
parent 8f7f205031
commit 154b932713
3 changed files with 3 additions and 5 deletions

View File

@ -196,7 +196,8 @@ module Make
Lwt_dropbox.take message_box >>= fun m -> Lwt_dropbox.take message_box >>= fun m ->
return (Some m) return (Some m)
| Some timeout -> | Some timeout ->
Lwt_dropbox.take_with_timeout timeout message_box >>= fun m -> Lwt_dropbox.take_with_timeout
(Lwt_unix.sleep timeout) message_box >>= fun m ->
return m return m
let trigger_shutdown w = let trigger_shutdown w =

View File

@ -88,6 +88,3 @@ let rec take_with_timeout timeout dropbox =
take_with_timeout timeout dropbox take_with_timeout timeout dropbox
else else
Lwt.return_none Lwt.return_none
let take_with_timeout timeout dropbox =
take_with_timeout (Lwt_unix.sleep timeout) dropbox

View File

@ -26,7 +26,7 @@ val take: 'a t -> 'a Lwt.t
The elements is removed from the dropbox. The function might return The elements is removed from the dropbox. The function might return
[Closed] if the dropbox is empty and closed. *) [Closed] if the dropbox is empty and closed. *)
val take_with_timeout: float -> 'a t -> 'a option Lwt.t val take_with_timeout: unit Lwt.t -> 'a t -> 'a option Lwt.t
(** Like [take] except that it returns [None] after [timeout seconds] (** Like [take] except that it returns [None] after [timeout seconds]
if the dropbox is still empty. *) if the dropbox is still empty. *)