package netchannel
Library
Module
Module type
Parameter
Class
Class type
Pool and reuse shared memory blocks. This saves having to reallocate and reshare pages of memory, which is slow. A block is half the size of a page, since network packets usually don't require more than this.
val make : (Xen_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 ->
Xen_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.