diff options
author | Dees_Troy <dees_troy@teamw.in> | 2013-01-16 21:35:51 +0100 |
---|---|---|
committer | Dees_Troy <dees_troy@teamw.in> | 2013-01-16 21:36:49 +0100 |
commit | ab4963c3691465047283b4c8ee8215e13b342b89 (patch) | |
tree | 4961c3026396132ff158efd7ef92f2bcd0ba344a /gui | |
parent | Add build flag for custom graphics (diff) | |
download | android_bootable_recovery-ab4963c3691465047283b4c8ee8215e13b342b89.tar android_bootable_recovery-ab4963c3691465047283b4c8ee8215e13b342b89.tar.gz android_bootable_recovery-ab4963c3691465047283b4c8ee8215e13b342b89.tar.bz2 android_bootable_recovery-ab4963c3691465047283b4c8ee8215e13b342b89.tar.lz android_bootable_recovery-ab4963c3691465047283b4c8ee8215e13b342b89.tar.xz android_bootable_recovery-ab4963c3691465047283b4c8ee8215e13b342b89.tar.zst android_bootable_recovery-ab4963c3691465047283b4c8ee8215e13b342b89.zip |
Diffstat (limited to '')
-rw-r--r-- | gui/action.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/gui/action.cpp b/gui/action.cpp index 85ad8eceb..1f3647d16 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -235,7 +235,41 @@ int GUIAction::doActions() // For multi-action, we always use a thread pthread_t t; - pthread_create(&t, NULL, thread_start, this); + pthread_attr_t tattr; + + if (pthread_attr_init(&tattr)) { + LOGE("Unable to pthread_attr_init\n"); + return -1; + } + if (pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_JOINABLE)) { + LOGE("Error setting pthread_attr_setdetachstate\n"); + return -1; + } + if (pthread_attr_setscope(&tattr, PTHREAD_SCOPE_SYSTEM)) { + LOGE("Error setting pthread_attr_setscope\n"); + return -1; + } + if (pthread_attr_setstacksize(&tattr, 524288)) { + LOGE("Error setting pthread_attr_setstacksize\n"); + return -1; + } + LOGI("creating thread\n"); + int ret = pthread_create(&t, &tattr, thread_start, this); + LOGI("after thread creation\n"); + if (ret) { + LOGE("Unable to create more threads for actions... continuing in same thread! %i\n", ret); + thread_start(this); + } else { + if (pthread_join(t, NULL)) { + LOGE("Error joining threads\n"); + } else { + LOGI("Thread joined\n"); + } + } + if (pthread_attr_destroy(&tattr)) { + LOGE("Failed to pthread_attr_destroy\n"); + return -1; + } return 0; } |