Skip to content

Commit

Permalink
Make set_thread_name future proof.
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Nov 11, 2024
1 parent fb28dac commit ac4266e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/tools/tutils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ let create ~queue f x s =
(fun () ->
let id =
let process x =
Utils.set_thread_name s;
Utils.Thread.set_current_thread_name s;
try
f x;
Mutex_utils.mutexify lock
Expand Down
2 changes: 1 addition & 1 deletion src/core/tools/unix_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ CAMLprim value liquidsoap_get_pagesize() {
#endif
}

CAMLprim value liquidsoap_set_thread_name(value _name) {
CAMLprim value liquidsoap_set_current_thread_name(value _name) {
#if defined(_WIN32)
char_os *thread_name = caml_stat_strdup_to_os(String_val(_name));
SetThreadDescription(GetCurrentThread(), thread_name);
Expand Down
7 changes: 6 additions & 1 deletion src/core/tools/utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ let log_exception ~(log : Log.t) ~bt msg =
log#severe "%s" msg;
if log#active 4 (* info *) then log#info "%s" bt

external set_thread_name : string -> unit = "liquidsoap_set_thread_name"
module Thread = struct
external set_current_thread_name : string -> unit
= "liquidsoap_set_current_thread_name"

include Thread
end

(* Force locale *)
external force_locale : string -> unit = "liquidsoap_set_locale"
Expand Down

0 comments on commit ac4266e

Please sign in to comment.