diff options
Diffstat (limited to 'gui/objects.hpp')
-rw-r--r-- | gui/objects.hpp | 29 |
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: |