yeet the mutex
This commit is contained in:
parent
59511905c9
commit
cac7a091fe
|
@ -36,12 +36,13 @@ let syslog_priority = function
|
|||
| ERROR -> "3" (* LOG_ERR *)
|
||||
|
||||
let writer t ~ts ~ns ~lvl msg =
|
||||
Mutex.lock t.mutex;
|
||||
let dgram =
|
||||
Mutex.protect t.mutex @@ fun () ->
|
||||
Buffer.clear t.buf;
|
||||
ignore ts;
|
||||
add_field t.buf "MESSAGE" (Printf.sprintf "%s: %s" ns msg);
|
||||
add_field t.buf "PRIORITY" (syslog_priority lvl);
|
||||
Buffer.to_bytes t.buf
|
||||
in
|
||||
Mutex.unlock t.mutex;
|
||||
Unix.sendto t.sock_fd dgram 0 (Bytes.length dgram) [] t.dest |> ignore
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
(* stub implementation since we actually aren't multithreaded *)
|
||||
type t = unit
|
||||
external create : unit -> t = "%identity"
|
||||
external lock : t -> unit = "%identity"
|
||||
external unlock : t -> unit = "%identity"
|
Loading…
Reference in New Issue