From 8fc0b8fc2a814035dc9cf8c7e211dc3a8f74d11b Mon Sep 17 00:00:00 2001 From: Krzysztof Jackiewicz Date: Thu, 27 Aug 2015 12:44:16 +0200 Subject: Fixed synchronisation issues [Problem] Production code mixed with test code. Poor readability. Synchronisation issues. [Solution] Synchronisation reimplemented. Test code separated from production code. [Verification] Run all test Change-Id: Iea5ed2ce9f10a4cdac8994acf91809cd12050d69 --- src/include/cchecker/logic.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/include') diff --git a/src/include/cchecker/logic.h b/src/include/cchecker/logic.h index aa50388..b5f1c22 100644 --- a/src/include/cchecker/logic.h +++ b/src/include/cchecker/logic.h @@ -97,10 +97,15 @@ class Logic { void *logic_ptr) ); + void push_event(event_t event); + void process_all(void); void process_queue(void); - void process_event(const event_t &event); + virtual void process_event(const event_t &event); + + bool process_app(app_t& app); void process_buffer(void); + virtual void app_processed() {}; // for tests bool get_online(void) const; void set_online(bool online); @@ -108,7 +113,7 @@ class Logic { bool get_should_exit(void) const; void set_should_exit(void); - void call_ui(const app_t &app); + bool call_ui(const app_t &app); Queue m_queue; Certs m_certs; @@ -117,6 +122,8 @@ class Logic { bool m_was_setup_called; bool m_is_online; + // TODO: use m_queue for online events + bool m_is_online_enabled; std::condition_variable m_to_process; std::mutex m_mutex_cv; std::thread m_thread; -- cgit v1.2.3