Client refactor: Remove usage of Lwt_unix
from Lwt_dropbox
This commit is contained in:
parent
8f7f205031
commit
154b932713
@ -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 =
|
||||||
|
@ -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
|
|
||||||
|
@ -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. *)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user