From 73a5295f6934065cd43e37e298609ad03f14b878 Mon Sep 17 00:00:00 2001 From: that Date: Wed, 28 Jan 2015 23:07:34 +0100 Subject: gui: run cancel action in another thread Some actions did not have an operation_end where needed especially when dealing with cancel actions. Cancel actions now do not run operation_start or operation_end and let the original action handle the operation_end so that the GUI waits until the original action acutally cancels. Change-Id: I28e6260abb058acb982cecd108c09fc89e0ffeed --- gui/objects.hpp | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'gui/objects.hpp') diff --git a/gui/objects.hpp b/gui/objects.hpp index bdccc6e42..c95a9356e 100644 --- a/gui/objects.hpp +++ b/gui/objects.hpp @@ -288,9 +288,11 @@ protected: std::map mKeys; protected: + enum ThreadType { THREAD_NONE, THREAD_ACTION, THREAD_CANCEL }; + int getKeyByName(std::string key); int doAction(Action action); - bool needsToRunInSeparateThread(const Action& action); + ThreadType getThreadType(const Action& action); void simulate_progress_bar(void); int flash_zip(std::string filename, int* wipe_cache); void reinject_after_flash(); @@ -365,25 +367,6 @@ protected: int simulate; }; -class ActionThread -{ -public: - ActionThread(); - ~ActionThread(); - - void threadActions(GUIAction *act); - void run(void *data); -private: - struct ThreadData - { - GUIAction *act; - }; - - pthread_t m_thread; - bool m_thread_running; - pthread_mutex_t m_act_lock; -}; - class GUIConsole : public GUIObject, public RenderObject, public ActionObject { public: -- cgit v1.2.3