/usr/lib/ocaml/netplex/netplex_mbox.mli is in libocamlnet-ocaml-dev 3.7.3-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | (* $Id$ *)
(** Netplex message boxes *)
(** This plugin implements a message box, following a simple model:
Receivers wait until messages are put into the box. Senders
wait until the box is free again.
This is actually an extension of {!Netplex_sharedvar}, and the
same caveats apply.
*)
open Netplex_types
val plugin : plugin
(** To enable message boxes, call the controller's [add_plugin] method
with this object as argument. This can e.g. be done in the
[post_add_hook] of the processor.
*)
(** How to use this module:
- Encapsulate the type of the messages:
{[ module Msg_type = struct type t = <some_type> end ]}
- Create the box module for this type:
{[ module Mbox_type = Netplex_mbox.Make_mbox_type(Msg_type) ]}
- Call functions of this module, e.g.
{[
let box = Mbox_type.create "my_box"
let msg = Mbox_type.receive box
]}
*)
(** The type of mailboxes [mbox] with messages of type [t] *)
module type MBOX = sig
type t
(** The type of messages *)
type mbox
(** The type of the mailboxes *)
val create : string -> mbox
(** Creates a new mailbox with the passed name, or opens an existing
mailbox. Names are global to the whole Netplex process system.
*)
val send : mbox -> t -> unit
(** Send a message to this box. If the box is full, it is waited until
the box is free again. If several senders wait for the box, one
sender is selected.
*)
val receive : mbox -> t
(** Receive a message: It is waited until a sender puts a message into
the box. If several receivers wait for the box, one receiver is
selected.
*)
end
module Make_mbox_type (T:Netplex_cenv.TYPE) : MBOX with type t = T.t
(** Create a new mailbox access module for message type [T.t] *)
|