summaryrefslogtreecommitdiffstats
path: root/gui/objects.hpp
diff options
context:
space:
mode:
authorthat <github@that.at>2015-01-09 22:12:43 +0100
committerthat <github@that.at>2015-01-09 22:12:43 +0100
commitc608548633d4c0e80a0dc748795a2445f7d48d5b (patch)
tree0d248b6ffd26de09decd24370f361f3615ddb610 /gui/objects.hpp
parentInclude libnetd_client in recovery (diff)
downloadandroid_bootable_recovery-c608548633d4c0e80a0dc748795a2445f7d48d5b.tar
android_bootable_recovery-c608548633d4c0e80a0dc748795a2445f7d48d5b.tar.gz
android_bootable_recovery-c608548633d4c0e80a0dc748795a2445f7d48d5b.tar.bz2
android_bootable_recovery-c608548633d4c0e80a0dc748795a2445f7d48d5b.tar.lz
android_bootable_recovery-c608548633d4c0e80a0dc748795a2445f7d48d5b.tar.xz
android_bootable_recovery-c608548633d4c0e80a0dc748795a2445f7d48d5b.tar.zst
android_bootable_recovery-c608548633d4c0e80a0dc748795a2445f7d48d5b.zip
Diffstat (limited to 'gui/objects.hpp')
-rw-r--r--gui/objects.hpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/gui/objects.hpp b/gui/objects.hpp
index 124c9264d..44c2b364e 100644
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -257,6 +257,8 @@ protected:
// GUIAction - Used for standard actions
class GUIAction : public GUIObject, public ActionObject
{
+ friend class ActionThread;
+
public:
GUIAction(xml_node<>* node);
@@ -281,20 +283,19 @@ protected:
protected:
int getKeyByName(std::string key);
int doAction(Action action);
+ bool needsToRunInSeparateThread(const Action& action);
void simulate_progress_bar(void);
int flash_zip(std::string filename, std::string pageName, int* wipe_cache);
void reinject_after_flash();
void operation_start(const string operation_name);
void operation_end(const int operation_status);
- static void* command_thread(void *cookie);
- static void* sideload_thread_fn(void *cookie);
- static void* openrecoveryscript_thread_fn(void *cookie);
time_t Start;
// map action name to function pointer
typedef int (GUIAction::*execFunction)(std::string);
typedef std::map<std::string, execFunction> mapFunc;
static mapFunc mf;
+ static std::set<std::string> setActionsRunningInCallerThread;
// GUI actions
int reboot(std::string arg);
@@ -323,7 +324,7 @@ protected:
int screenshot(std::string arg);
int setbrightness(std::string arg);
- // threaded actions
+ // (originally) threaded actions
int fileexists(std::string arg);
int flash(std::string arg);
int wipe(std::string arg);
@@ -355,6 +356,26 @@ protected:
int simulate;
};
+class ActionThread
+{
+public:
+ ActionThread();
+ ~ActionThread();
+
+ void threadActions(GUIAction *act, size_t start_index);
+ void run(void *data);
+private:
+ struct ThreadData
+ {
+ GUIAction *act;
+ size_t start_index;
+ };
+
+ pthread_t m_thread;
+ bool m_thread_running;
+ pthread_mutex_t m_act_lock;
+};
+
class GUIConsole : public GUIObject, public RenderObject, public ActionObject
{
public: