Plasma GitLab Archive
Projects Blog Knowledge

Module Netplex_mbox

module Netplex_mbox: sig .. end
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.

val plugin : Netplex_types.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
          

module type MBOX = sig .. end
The type of mailboxes mbox with messages of type t
module Make_mbox_type: 
functor (T : Netplex_cenv.TYPE) -> MBOX with type t = T.t
Create a new mailbox access module for message type T.t
This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml