2016-01-07 06:24:35 -05:00
|
|
|
(* Copyright (C) 2016, Thomas Leonard <thomas.leonard@unikernel.com>
|
|
|
|
See the README file for details. *)
|
|
|
|
|
|
|
|
(** Keep track of the queue length for output buffers. *)
|
|
|
|
|
|
|
|
type t
|
|
|
|
|
|
|
|
val create : string -> t
|
|
|
|
(** [create name] is a new empty queue. [name] is used in log messages. *)
|
|
|
|
|
2017-04-29 06:42:31 -04:00
|
|
|
val send : t -> (unit -> unit Lwt.t) -> unit Lwt.t
|
2016-01-07 06:24:35 -05:00
|
|
|
(** [send t fn] checks that the queue isn't overloaded and calls [fn ()] if it's OK.
|
|
|
|
The item is considered to be queued until the result of [fn] has resolved.
|
|
|
|
In the case of mirage-net-xen's [writev], this happens when the frame has been
|
|
|
|
added to the ring (not when it is consumed), which is fine for us. *)
|