Client refactor: Remove usage of Lwt_unix
from Lwt_pipe
This commit is contained in:
parent
7a3277e625
commit
8f7f205031
@ -184,7 +184,8 @@ module Make
|
||||
Lwt_pipe.pop message_queue >>= fun m ->
|
||||
return (Some m)
|
||||
| Some timeout ->
|
||||
Lwt_pipe.pop_with_timeout timeout message_queue >>= fun m ->
|
||||
Lwt_pipe.pop_with_timeout
|
||||
(Lwt_unix.sleep timeout) message_queue >>= fun m ->
|
||||
return m in
|
||||
match w.buffer with
|
||||
| Queue_buffer message_queue -> pop_queue message_queue
|
||||
|
@ -144,9 +144,6 @@ let rec pop_with_timeout timeout q =
|
||||
else
|
||||
Lwt.return_none
|
||||
|
||||
let pop_with_timeout timeout q =
|
||||
pop_with_timeout (Lwt_unix.sleep timeout) q
|
||||
|
||||
let rec peek ({ closed ; queue ; _ } as q) =
|
||||
if not (Queue.is_empty queue) then
|
||||
let (_elt_size, elt) = Queue.peek queue in
|
||||
|
@ -29,7 +29,7 @@ val pop : 'a t -> 'a Lwt.t
|
||||
(** [pop q] is a thread that blocks while [q] is empty, then
|
||||
removes and returns the first element in [q]. *)
|
||||
|
||||
val pop_with_timeout : float -> 'a t -> 'a option Lwt.t
|
||||
val pop_with_timeout : unit Lwt.t -> 'a t -> 'a option Lwt.t
|
||||
(** [pop t q] is a thread that blocks while [q] is empty, then
|
||||
removes and returns the first element [v] in [q] and
|
||||
to return [Some v], unless no message could be popped
|
||||
|
Loading…
Reference in New Issue
Block a user