From b31f9ce6d150a264f584d9b38a54da0723fc249c Mon Sep 17 00:00:00 2001 From: Jerry Zhang Date: Mon, 21 May 2018 16:04:57 -0700 Subject: recovery: c++ify pthread use in UI Change pthread usage to std::mutex, lock_guard, unique_lock, thread, or condition_variable as appropriate. Test: Recovery works, recovery_component_test pass Bug: 78793464 Change-Id: Ibf0b1bbedcf0b6e32fc4ee6aaadd17f21b4d7077 --- wear_ui.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'wear_ui.cpp') diff --git a/wear_ui.cpp b/wear_ui.cpp index f4a839923..65c4aeed6 100644 --- a/wear_ui.cpp +++ b/wear_ui.cpp @@ -16,7 +16,6 @@ #include "wear_ui.h" -#include #include #include @@ -86,11 +85,10 @@ void WearRecoveryUI::SetStage(int /* current */, int /* max */) {} void WearRecoveryUI::StartMenu(const std::vector& headers, const std::vector& items, size_t initial_selection) { - pthread_mutex_lock(&updateMutex); + std::lock_guard lg(updateMutex); if (text_rows_ > 0 && text_cols_ > 0) { menu_ = std::make_unique(scrollable_menu_, text_rows_ - kMenuUnusableRows - 1, text_cols_ - 1, headers, items, initial_selection); update_screen_locked(); } - pthread_mutex_unlock(&updateMutex); } -- cgit v1.2.3