~marionnet-drivers/marionnet/trunk

520 by Jean-Vincent Loddo
Added interface death_monitor.mli. Also, slightly simplified simulation_level.mli
1
(* This file is part of Marionnet, a virtual network laboratory
2
   Copyright (C) 2020  Jean-Vincent Loddo
3
   Copyright (C) 2020  Université Sorbonne Paris Nord
4
5
   This program is free software: you can redistribute it and/or modify
6
   it under the terms of the GNU General Public License as published by
7
   the Free Software Foundation, either version 2 of the License, or
8
   (at your option) any later version.
9
10
   This program is distributed in the hope that it will be useful,
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
   GNU General Public License for more details.
14
15
   You should have received a copy of the GNU General Public License
16
   along with this program.  If not, see <http://www.gnu.org/licenses/>. *)
17
18
type process_name = string                      (* name of the executable program we're monitoring *)
19
type pid = int                                  (* process identifier *)
20
(* --- *)
21
type predicate = (pid -> bool)                  (* how to check whether we should invoke the callback *)
22
type callback  = (pid -> process_name -> unit)  (* the callback *)
23
24
(* By default the predicate which causes the callback invocation is "process not alive": *)
25
val start_monitoring  : ?predicate:(pid -> bool) -> pid -> process_name -> callback -> unit
26
val stop_monitoring   : pid -> unit
27
(* --- *)
28
val stop_polling_loop : unit -> unit