diff options
author | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-09-12 11:29:28 +0200 |
---|---|---|
committer | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-09-12 11:29:28 +0200 |
commit | b154238b7b9e0d21b60c08a1bec23920bff40e36 (patch) | |
tree | a9aef373b01f3637d823046322b43ef6387a2349 /src/app.cpp | |
parent | 01058af8b919e1c58207008ea9609f2e7b23efac (diff) |
binding: ping() dispatches only pending events
* Also, move binding_m mutex to the binding glue.
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
Diffstat (limited to 'src/app.cpp')
-rw-r--r-- | src/app.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/app.cpp b/src/app.cpp index e42d05f..7b2b69c 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -147,9 +147,8 @@ int App::init() { } int App::dispatch_events() { - if (this->pending_events.load(std::memory_order_consume)) { - this->pending_events.store(false, std::memory_order_release); - return this->display->dispatch_pending(); + if (this->dispatch_events() == 0) { + return 0; } int ret = this->display->dispatch(); @@ -166,6 +165,15 @@ int App::dispatch_events() { return 0; } +int App::dispatch_pending_events() { + if (this->pending_events.load(std::memory_order_consume)) { + this->pending_events.store(false, std::memory_order_release); + this->display->dispatch_pending(); + return 0; + } + return -1; +} + // _ _ _ _ _ ____ // (_)_ __ (_) |_ | | __ _ _ _ ___ _ _| |_ / /\ \ // | | '_ \| | __| | |/ _` | | | |/ _ \| | | | __| | | | |