From 83555b0c53f0d59f42e9dcfaeb269948e65e0391 Mon Sep 17 00:00:00 2001 From: Marcus Fritzsch Date: Tue, 12 Sep 2017 11:29:28 +0200 Subject: binding: make the pending_events functionality nicer[tm] Signed-off-by: Marcus Fritzsch --- src/app.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/app.hpp') diff --git a/src/app.hpp b/src/app.hpp index e295797..c4c0a81 100644 --- a/src/app.hpp +++ b/src/app.hpp @@ -148,7 +148,16 @@ struct App { struct LayoutState state; + // Set by AFB API when wayland events need to be dispatched std::atomic pending_events; + void set_pending_events() { + this->pending_events.store(true, std::memory_order_release); + } + bool pop_pending_events() { + bool x{true}; + return this->pending_events.compare_exchange_strong( + x, false, std::memory_order_consume); + } explicit App(wl::display *d); ~App(); -- cgit 1.2.3-korg