Codechange: Replace custom mutex code with C++11 mutex'es.

A conforming compiler with a valid <mutex>-header is expected.
Most parts of the code assume that locking a mutex will never fail unexpectedly,
which is generally true on all common platforms that don't just pretend to
be C++11. The use of condition variables in driver code is checked.
This commit is contained in:
Michael Lutz
2019-03-11 00:45:39 +01:00
parent 3b86f54fc7
commit 05f4e73608
19 changed files with 187 additions and 426 deletions

View File

@@ -10,17 +10,19 @@
/** @file progress.cpp Functions for modal progress windows. */
#include "stdafx.h"
#include "thread/thread.h"
#include "progress.h"
#include "safeguards.h"
/** Are we in a modal progress or not? */
bool _in_modal_progress = false;
bool _first_in_modal_loop = false;
/** Threading usable for modal progress? */
bool _use_threaded_modal_progress = true;
/** Rights for the performing work. */
ThreadMutex *_modal_progress_work_mutex = ThreadMutex::New();
std::mutex _modal_progress_work_mutex;
/** Rights for the painting. */
ThreadMutex *_modal_progress_paint_mutex = ThreadMutex::New();
std::mutex _modal_progress_paint_mutex;
/**
* Set the modal progress state.