Module type Messaging.S
type relay_messagetype output_message=|Log of int * stringLog message with level
|Stat of stringStatistics
|Progress of intProgress
A message to be output to the user
type control_message=|ReadyProcess is ready
|PingRequest reply from process
|TerminateRequest termination of process
|Resend of intRequest resending of relay message
A message internal to the messaging system
type message=|OutputMessage of output_messageOutput to user
|ControlMessage of control_messageMessage internal to the messaging system
|RelayMessage of int * relay_messageMessage to be broadcast to worker processes
A message
val init_im : unit -> (ctx * socket * socket) * (string * string)Create a messaging context and bind ports for the invariant manager. Return a pair of pub socket and pull socket and pair of addresses of pub and pull sockets for workers to connect to.
Call this function before forking the processes, the first return argument must only be used by the parent process, the child processes must use the socket addresses in the second return argument.
val init_worker : Lib.kind_module -> string -> string -> ctx * socket * socketCreate a messaging context and bind given ports for a worker process. Return a messaging context and a pair of sub and push sockets.
val run_im : (ctx * socket * socket) -> (int * Lib.kind_module) list -> (exn -> unit) -> unitStart the background thread for the invariant manager, using the given context and sockets. The second parameter is a list of PIDs and the kind of worker processes to watch, the third argument is the function to call to handle exceptions.
val run_worker : (ctx * socket * socket) -> Lib.kind_module -> (exn -> unit) -> threadStart the background thread for a worker process, using the given context and sockets. The second parameter is type of worker process, the third is the function to call to handle exceptions.
val send_relay_message : relay_message -> unitBroadcast a message to the worker processes
val send_output_message : output_message -> unitSend a message to the invariant manager for output to the user
val recv : unit -> (Lib.kind_module * message) listReceive messages queued by the background thread
val update_child_processes_list : (int * Lib.kind_module) list -> unitNotifies the background thread of a new list of child processes. Used by the supervisor in a modular analysis when restarting.
val purge_im_mailbox : (ctx * socket * socket) -> unitPurge the invariant manager mailbox. Should be called before calling update_child_processes_list in order to get rid of messages from the previous analysis.
val check_termination : unit -> boolReturns true if a termination message was received. Does NOT modify received message in any way.
val exit : thread -> unitRequest the background thread of a worker process to terminate