Improve usage of initprintf mutex

git-svn-id: https://svn.eduke32.com/eduke32@7908 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-08-07 22:44:00 +00:00 committed by Christoph Oelckers
parent 064516c050
commit c1aff49e4c

View file

@ -726,10 +726,11 @@ void initputs(const char *buf)
OSD_Puts(buf); OSD_Puts(buf);
// Bprintf("%s", buf); // Bprintf("%s", buf);
mutex_lock(&m_initprintf);
if (Bstrlen(dabuf) + Bstrlen(buf) > 1022) if (Bstrlen(dabuf) + Bstrlen(buf) > 1022)
{ {
mutex_lock(&m_initprintf);
startwin_puts(dabuf); startwin_puts(dabuf);
mutex_unlock(&m_initprintf);
Bmemset(dabuf, 0, sizeof(dabuf)); Bmemset(dabuf, 0, sizeof(dabuf));
} }
@ -737,7 +738,9 @@ void initputs(const char *buf)
if (g_logFlushWindow || Bstrlen(dabuf) > 768) if (g_logFlushWindow || Bstrlen(dabuf) > 768)
{ {
mutex_lock(&m_initprintf);
startwin_puts(dabuf); startwin_puts(dabuf);
mutex_unlock(&m_initprintf);
#ifndef _WIN32 #ifndef _WIN32
startwin_idle(NULL); startwin_idle(NULL);
#else #else
@ -745,7 +748,6 @@ void initputs(const char *buf)
#endif #endif
Bmemset(dabuf, 0, sizeof(dabuf)); Bmemset(dabuf, 0, sizeof(dabuf));
} }
mutex_unlock(&m_initprintf);
} }
// //