From 367ff755a26e44dd115142a306b4437f1bb16dc9 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 7 Dec 2023 19:57:18 +0100 Subject: [PATCH] move lock --- client/src/ui.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/ui.c b/client/src/ui.c index 153b26ecd..fc3f7908a 100644 --- a/client/src/ui.c +++ b/client/src/ui.c @@ -317,8 +317,7 @@ static void fPrintAndLog(FILE *stream, const char *fmt, ...) { char buffer[MAX_PRINT_BUFFER] = {0}; char buffer2[MAX_PRINT_BUFFER] = {0}; char buffer3[MAX_PRINT_BUFFER] = {0}; - // lock this section to avoid interlacing prints from different threads - pthread_mutex_lock(&g_print_lock); + bool linefeed = true; if (logging && g_session.incognito) { @@ -353,6 +352,8 @@ static void fPrintAndLog(FILE *stream, const char *fmt, ...) { } } + // lock this section to avoid interlacing prints from different threads + pthread_mutex_lock(&g_print_lock); // If there is an incoming message from the hardware (eg: lf hid read) in // the background (while the prompt is displayed and accepting user input),