binding: manual lock on API call, do not use noconcurrent bit
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>
Tue, 12 Sep 2017 09:29:27 +0000 (11:29 +0200)
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>
Tue, 12 Sep 2017 09:29:27 +0000 (11:29 +0200)
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
generate-binding-glue.py
src/main.cpp

index db0b546..086ad32 100644 (file)
@@ -49,7 +49,7 @@ def emit_func_impl(api, f):
 
 def emit_func(api, f):
     p('void %(impl_name)s(afb_req req) noexcept {' % f)
-    #p('   std::lock_guard<std::mutex> guard(binding_m);')
+    p('   std::lock_guard<std::mutex> guard(binding_m);')
     p('   #ifdef ST')
     p('   ST();')
     p('   #endif')
index 4bb53b3..4c04f74 100644 (file)
@@ -30,7 +30,7 @@ extern "C" {
 }
 
 namespace {
-//std::mutex binding_m;
+std::mutex binding_m;
 
 struct afb_instance {
    std::unique_ptr<wl::display> display;
@@ -54,7 +54,6 @@ int afb_instance::init() {
 int display_event_callback(sd_event_source *evs, int fd, uint32_t events,
                            void * /*data*/) {
    ST();
-   // std::lock_guard<std::mutex> guard(binding_m);
 
    if ((events & EPOLLHUP) != 0) {
       logerror("The compositor hung up, dying now.");
@@ -156,4 +155,4 @@ void binding_api::send_event(char const *evname, char const *label) {
 }
 
 extern "C" const struct afb_binding_v2 afbBindingV2 = {
-   "winman", nullptr, nullptr, winman_verbs, nullptr, binding_init, nullptr, 1};
+   "winman", nullptr, nullptr, winman_verbs, nullptr, binding_init, nullptr, 0};