Display, Log: use mutex to synchronize display and log modules
diff --git a/display.c b/display.c
index 50c4ceb..3febf1a 100644
--- a/display.c
+++ b/display.c
@@ -56,7 +56,7 @@
     }
 }
 
-extern void display_display(honggfuzz_t * hfuzz)
+static void display_displayLocked(honggfuzz_t * hfuzz)
 {
     unsigned long elapsed = (unsigned long)(time(NULL) - hfuzz->timeStart);
 
@@ -104,12 +104,12 @@
                 ")\n", hfuzz->dynamicFileBestSz, hfuzz->maxFileSz);
 
     display_put("Coverage (max):\n");
-    display_put("  CPU instructions:      " ESC_BOLD "%zu" ESC_RESET "\n",
+    display_put("  cpu instructions:      " ESC_BOLD "%zu" ESC_RESET "\n",
                 __sync_fetch_and_add(&hfuzz->branchBestCnt[0], 0UL));
-    display_put("  CPU branches:          " ESC_BOLD "%zu" ESC_RESET "\n",
+    display_put("  cpu branches:          " ESC_BOLD "%zu" ESC_RESET "\n",
                 __sync_fetch_and_add(&hfuzz->branchBestCnt[1], 0UL));
     if (hfuzz->dynFileMethod & _HF_DYNFILE_UNIQUE_BLOCK_COUNT) {
-        display_put("  unique branch origins: ");
+        display_put("  unique branch targets: ");
     } else {
         display_put("  unique branch pairs:   ");
     }
@@ -118,3 +118,10 @@
                 __sync_fetch_and_add(&hfuzz->branchBestCnt[3], 0UL));
     display_put("============================== LOGS ==============================\n");
 }
+
+extern void display_display(honggfuzz_t * hfuzz)
+{
+    log_mutexLock();
+    display_displayLocked(hfuzz);
+    log_mutexUnLock();
+}
diff --git a/log.c b/log.c
index 2b753f8..3ce07e8 100644
--- a/log.c
+++ b/log.c
@@ -66,6 +66,16 @@
     log_minLevel = dl;
 }
 
+void log_mutexLock(void)
+{
+    while (pthread_mutex_lock(&log_mutex)) ;
+}
+
+void log_mutexUnLock(void)
+{
+    while (pthread_mutex_unlock(&log_mutex)) ;
+};
+
 void log_msg(log_level_t dl, bool perr, const char *file, const char *func, int line,
              const char *fmt, ...)
 {
@@ -124,10 +134,10 @@
 
     util_ssnprintf(msg, sizeof(msg), "\n");
 
-    while (pthread_mutex_lock(&log_mutex)) ;
+    log_mutexLock();
     if (write(STDOUT_FILENO, msg, strlen(msg)) == -1) {
     }
-    while (pthread_mutex_unlock(&log_mutex)) ;
+    log_mutexUnLock();
 
     if (dl == l_FATAL) {
         exit(EXIT_FAILURE);
diff --git a/log.h b/log.h
index 5bf4128..3451c8f 100644
--- a/log.h
+++ b/log.h
@@ -24,6 +24,8 @@
 #ifndef _LOG_H_
 #define _LOG_H_
 
+#include <pthread.h>
+
 typedef enum {
     l_FATAL = 0, l_ERROR, l_WARN, l_INFO, l_DEBUG
 } log_level_t;
@@ -33,6 +35,9 @@
 extern void log_msg(log_level_t dl, bool perr, const char *file, const char *func, int line,
                     const char *fmt, ...);
 
+extern void log_mutexLock(void);
+extern void log_mutexUnLock(void);
+
 #define LOGMSG(ll, ...) log_msg(ll, false, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__);
 #define LOGMSG_P(ll, ...) log_msg(ll, true, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__);