(** Functions which implement useful operations not related to any particular type *) val and_then : (unit -> 'a) -> (unit -> 'b) -> 'a (** [and_then f g] - evaluate [f] and then evaluate [g], even if [f] raises an exception. Return the value that [f] returned. *) val stopwatch : (unit -> 'a) -> float * 'a (** [stopwatch f] - evalute [f] and return its result value and the number of seconds that elapsed during its evaluation. *) val index : (int -> bool) -> int -> int -> int (** [index f min max] - pass integers to f starting with min and continuing until we reach max, and return the first one [i] for which [f i] is true. *) val wrap : (unit -> unit) -> (unit -> 'a) -> (unit -> unit) -> 'a (** [wrap before thunk after] - Somewhat misguided extension of and_then. *) exception Timeout val do_locked : ?timeout:int -> ?waitfn:(int -> bool -> unit) -> string -> (unit -> 'a) -> 'a (** [do_locked ?timeout ?waitfn lockfile f] - Execute [f] while holding a [lockfile] containing our process ID. If we can't create [lockfile], see if the process that created it is still alive. If not, break the lock. If it is, call [waitfn] up to [timeout] times. *)