1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[misc] improve uprintf() concurrency by using a mutex

This commit is contained in:
Pete Batard 2021-02-03 11:36:52 +00:00
parent 20b8a84595
commit 53b014781d
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
2 changed files with 13 additions and 5 deletions

View file

@ -35,7 +35,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.14.1734"
CAPTION "Rufus 3.14.1735"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -397,8 +397,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,14,1734,0
PRODUCTVERSION 3,14,1734,0
FILEVERSION 3,14,1735,0
PRODUCTVERSION 3,14,1735,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -416,13 +416,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.14.1734"
VALUE "FileVersion", "3.14.1735"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.14.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.14.1734"
VALUE "ProductVersion", "3.14.1735"
END
END
BLOCK "VarFileInfo"

View file

@ -43,6 +43,7 @@
HWND hStatus;
size_t ubuffer_pos = 0;
char ubuffer[UBUFFER_SIZE]; // Buffer for ubpushf() messages we don't log right away
static HANDLE print_mutex = NULL;
void _uprintf(const char *format, ...)
{
@ -52,6 +53,11 @@ void _uprintf(const char *format, ...)
va_list args;
int n;
if (print_mutex == NULL)
print_mutex = CreateMutex(NULL, FALSE, NULL);
if (WaitForSingleObject(print_mutex, INFINITE) != WAIT_OBJECT_0)
return;
va_start(args, format);
n = safe_vsnprintf(p, sizeof(buf)-3, format, args); // buf-3 is room for CR/LF/NUL
va_end(args);
@ -78,6 +84,8 @@ void _uprintf(const char *format, ...)
Edit_Scroll(hLog, Edit_GetLineCount(hLog), 0);
}
free(wbuf);
ReleaseMutex(print_mutex);
}
void _uprintfs(const char* str)