summaryrefslogtreecommitdiffstats
path: root/screen_ui.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-04-13 22:52:10 +0200
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-13 22:52:10 +0200
commit6564544e1efe9262d61ce031db32a76e28762472 (patch)
tree9c50497f0d82bb99eed807a84715b827a7d07a73 /screen_ui.cpp
parentam 507630e9: am b68c4fc4: Merge "Treat KEY_ENTER the same as KEY_POWER in the pager." (diff)
parentam eab12de7: Merge "Remove unnecessary globals." (diff)
downloadandroid_bootable_recovery-6564544e1efe9262d61ce031db32a76e28762472.tar
android_bootable_recovery-6564544e1efe9262d61ce031db32a76e28762472.tar.gz
android_bootable_recovery-6564544e1efe9262d61ce031db32a76e28762472.tar.bz2
android_bootable_recovery-6564544e1efe9262d61ce031db32a76e28762472.tar.lz
android_bootable_recovery-6564544e1efe9262d61ce031db32a76e28762472.tar.xz
android_bootable_recovery-6564544e1efe9262d61ce031db32a76e28762472.tar.zst
android_bootable_recovery-6564544e1efe9262d61ce031db32a76e28762472.zip
Diffstat (limited to 'screen_ui.cpp')
-rw-r--r--screen_ui.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/screen_ui.cpp b/screen_ui.cpp
index cca261fc4..76793350a 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -39,11 +39,6 @@
static int char_width;
static int char_height;
-// There's only (at most) one of these objects, and global callbacks
-// (for pthread_create, and the input event system) need to find it,
-// so use a global variable.
-static ScreenRecoveryUI* self = nullptr;
-
// Return the current time as a double (including fractions of a second).
static double now() {
struct timeval tv;
@@ -83,7 +78,6 @@ ScreenRecoveryUI::ScreenRecoveryUI() :
backgroundIcon[i] = nullptr;
}
pthread_mutex_init(&updateMutex, nullptr);
- self = this;
}
// Clear the screen and draw the currently selected background icon (if any).
@@ -283,14 +277,14 @@ void ScreenRecoveryUI::update_progress_locked() {
}
// Keeps the progress bar updated, even when the process is otherwise busy.
-void* ScreenRecoveryUI::progress_thread(void *cookie) {
- self->progress_loop();
+void* ScreenRecoveryUI::ProgressThreadStartRoutine(void* data) {
+ reinterpret_cast<ScreenRecoveryUI*>(data)->ProgressThreadLoop();
return nullptr;
}
-void ScreenRecoveryUI::progress_loop() {
+void ScreenRecoveryUI::ProgressThreadLoop() {
double interval = 1.0 / animation_fps;
- for (;;) {
+ while (true) {
double start = now();
pthread_mutex_lock(&updateMutex);
@@ -387,7 +381,7 @@ void ScreenRecoveryUI::Init() {
LoadLocalizedBitmap("no_command_text", &backgroundText[NO_COMMAND]);
LoadLocalizedBitmap("error_text", &backgroundText[ERROR]);
- pthread_create(&progress_t, nullptr, progress_thread, nullptr);
+ pthread_create(&progress_thread_, nullptr, ProgressThreadStartRoutine, this);
RecoveryUI::Init();
}