lg2: Add mutex to avoid stderr line corruption

Use of a mutex, along with flushing after every line, prevents threads
in multithreaded programs from corrupting each other's stderr logging
lines. As for the D-Bus journal messages, they are already atomic, not
needing this fix.

Tested: The corruption appears fixed
https://gist.github.com/Krellan/d5d9942cb5ab405c9689e4eb4bb75cf0

Change-Id: I1db88139406eb617aa713740d5ccb6c9420ca773
Signed-off-by: Josh Lehan <krellan@google.com>
diff --git a/lib/meson.build b/lib/meson.build
index 1de91ec..9c65652 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -4,10 +4,13 @@
 
 subdir('include/phosphor-logging')
 
+threads_dep = dependency('threads')
+
 phosphor_logging_deps = [
     pdi_dep,
     sdbusplus_dep,
     systemd_dep,
+    threads_dep
 ]
 
 phosphor_logging_lib = library(