diff options
Diffstat (limited to 'screen_ui.h')
-rw-r--r-- | screen_ui.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/screen_ui.h b/screen_ui.h index c90a2cd17..b76d4706e 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -17,12 +17,13 @@ #ifndef RECOVERY_SCREEN_UI_H #define RECOVERY_SCREEN_UI_H -#include <pthread.h> #include <stdio.h> +#include <atomic> #include <functional> #include <memory> #include <string> +#include <thread> #include <vector> #include "ui.h" @@ -112,6 +113,7 @@ class ScreenRecoveryUI : public RecoveryUI { ScreenRecoveryUI(); explicit ScreenRecoveryUI(bool scrollable_menu); + ~ScreenRecoveryUI() override; bool Init(const std::string& locale) override; std::string GetLocale() const override; @@ -189,7 +191,6 @@ class ScreenRecoveryUI : public RecoveryUI { GRSurface* GetCurrentFrame() const; GRSurface* GetCurrentText() const; - static void* ProgressThreadStartRoutine(void* data); void ProgressThreadLoop(); virtual void ShowFile(FILE*); @@ -275,7 +276,8 @@ class ScreenRecoveryUI : public RecoveryUI { // An alternate text screen, swapped with 'text_' when we're viewing a log file. char** file_viewer_text_; - pthread_t progress_thread_; + std::thread progress_thread_; + std::atomic<bool> progress_thread_stopped_{ false }; // Number of intro frames and loop frames in the animation. size_t intro_frames; @@ -293,7 +295,7 @@ class ScreenRecoveryUI : public RecoveryUI { std::string locale_; bool rtl_locale_; - pthread_mutex_t updateMutex; + std::mutex updateMutex; private: void SetLocale(const std::string&); |