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:
@@ -12,7 +12,7 @@
|
||||
#ifndef PROGRESS_H
|
||||
#define PROGRESS_H
|
||||
|
||||
#include "thread/thread.h"
|
||||
#include <mutex>
|
||||
|
||||
static const uint MODAL_PROGRESS_REDRAW_TIMEOUT = 200; ///< Timeout between redraws
|
||||
|
||||
@@ -26,10 +26,20 @@ static inline bool HasModalProgress()
|
||||
return _in_modal_progress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we can use a thread for modal progress.
|
||||
* @return Threading usable?
|
||||
*/
|
||||
static inline bool UseThreadedModelProgress()
|
||||
{
|
||||
extern bool _use_threaded_modal_progress;
|
||||
return _use_threaded_modal_progress;
|
||||
}
|
||||
|
||||
bool IsFirstModalProgressLoop();
|
||||
void SetModalProgress(bool state);
|
||||
|
||||
extern class ThreadMutex *_modal_progress_work_mutex;
|
||||
extern class ThreadMutex *_modal_progress_paint_mutex;
|
||||
extern std::mutex _modal_progress_work_mutex;
|
||||
extern std::mutex _modal_progress_paint_mutex;
|
||||
|
||||
#endif /* PROGRESS_H */
|
||||
|
Reference in New Issue
Block a user