diff --git a/CHANGES.md b/CHANGES.md index 25dfca7..385d087 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,7 @@ 0.3.1 (unreleased) ===== * Added missing dependency on `ocamlfind` +* Start/stop log processing on `startup`/`cleanup`. 0.3.0 (2022-03-04) ===== diff --git a/src/srt.ml b/src/srt.ml index 447ff25..b9fec70 100644 --- a/src/srt.ml +++ b/src/srt.ml @@ -304,8 +304,6 @@ let close s = let getsockstate = getsockstate let create_socket = create_socket -let cleanup = cleanup -let startup = startup module SocketSet = Set.Make (struct type t = Srt.socket @@ -460,7 +458,7 @@ module Log = struct let should_stop = Atomic.make true - let start_processing () = + let startup () = Atomic.set should_stop false; ignore (Thread.create @@ -470,7 +468,7 @@ module Log = struct !log_fn msg)) ()) - let stop_processing () = Atomic.set should_stop true + let cleanup () = Atomic.set should_stop true end module Stats = struct @@ -637,3 +635,11 @@ module Stats = struct ignore (check_err (bistats socket stats clear instantaneous)); from_struct stats end + +let cleanup () = + cleanup (); + Log.cleanup () + +let startup () = + Log.startup (); + startup () diff --git a/src/srt.mli b/src/srt.mli index 1c2ff36..b40aeb3 100644 --- a/src/srt.mli +++ b/src/srt.mli @@ -133,8 +133,6 @@ module Log : sig type level = [ `Critical | `Error | `Warning | `Notice | `Debug ] - val start_processing : unit -> unit - val stop_processing : unit -> unit val setloglevel : level -> unit val set_handler : (msg -> unit) -> unit val clear_handler : unit -> unit