Skip to content

Commit

Permalink
Tied up to top-level.
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Jul 27, 2024
1 parent bb99ea3 commit 24e0c0a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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)
=====
Expand Down
14 changes: 10 additions & 4 deletions src/srt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 ()
2 changes: 0 additions & 2 deletions src/srt.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 24e0c0a

Please sign in to comment.