diff options
author | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-09-12 11:29:27 +0200 |
---|---|---|
committer | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-09-12 11:29:27 +0200 |
commit | 793166f301c058503c37553204c4d4c2b106ff23 (patch) | |
tree | b83acb7446554328e9d070681ea7ac0a8def45b9 /src/main.cpp | |
parent | 6b648180458e9625e1f700962537c3d4e501f6cc (diff) |
app/main: dispatch wayland events using ping(), WIP on split layout
* Dispatch ayland events with ping() API call, after having read events
from wayland fd - in order to prevent indefinite-poll on wrongly read+
dispatch from multiple threads (dispatcher and API call).
* Add scope trace to all API call thunks.
* Split layout advancements, still broken AF though.
* Add App1 example split layout to App layer.
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp index d944c24..4bb53b3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -30,7 +30,7 @@ extern "C" { } namespace { -std::mutex binding_m; +//std::mutex binding_m; struct afb_instance { std::unique_ptr<wl::display> display; @@ -51,9 +51,10 @@ int afb_instance::init() { return this->app.init(); } -int display_event_callback(sd_event_source *evs, int /*fd*/, uint32_t events, +int display_event_callback(sd_event_source *evs, int fd, uint32_t events, void * /*data*/) { - std::lock_guard<std::mutex> guard(binding_m); + ST(); + // std::lock_guard<std::mutex> guard(binding_m); if ((events & EPOLLHUP) != 0) { logerror("The compositor hung up, dying now."); @@ -63,8 +64,16 @@ int display_event_callback(sd_event_source *evs, int /*fd*/, uint32_t events, } if ((events & EPOLLIN) != 0u) { - if (g_afb_instance->app.dispatch_events() == -1) { - goto error; + { + STN(display_read_events); + g_afb_instance->app.display->read_events(); + g_afb_instance->app.pending_events.store(true, std::memory_order_release); + } + { + STN(winman_ping_api_call); + afb_service_call("winman", "ping", json_object_new_object(), [](void *c, int st, json_object* j) { + STN(winman_ping_api_call_return); + }, nullptr); } } |