val make : (OS.Xen.Gntref.t -> Io_page.t -> unit) -> t
make grant_access
is a shared pool of blocks. When a new page is first allocated, grant_access
is called to share it.
val use : t -> (id:Cstruct.uint16 -> OS.Xen.Gntref.t -> Cstruct.t -> ('a * unit Lwt.t) Lwt.t) -> ('a * unit Lwt.t) Lwt.t
use t fn
calls fn ~id gref block
with a free shared block of memory and that block's unique ID (note: the gref
is NOT unique). The function should return a thread that indicates when the request has been added to the queue, by returning a result value and a second thread indicating when the block can be returned to the pool.
val shutdown : t -> unit
Unshare and free all the pages of the pool once all outstanding requests have completed. Calling use
after shutdown
will return an error.