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
diff --git a/gui/objects.hpp b/gui/objects.hpp
index bdccc6e..c95a935 100644
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -288,9 +288,11 @@
std::map<int, bool> 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 @@
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: