X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-ws-json1.c;h=c796b17cea98d28ed54dc556bba3927f239314df;hb=b596b217c9b82d6be2b1d5486cdced31831aebc3;hp=50980d7b6918cc58a81ac509a318d344857b1315;hpb=a8e971702f23ee67e02b4716ad4159f12cefdca6;p=src%2Fapp-framework-binder.git diff --git a/src/afb-ws-json1.c b/src/afb-ws-json1.c index 50980d7b..c796b17c 100644 --- a/src/afb-ws-json1.c +++ b/src/afb-ws-json1.c @@ -25,7 +25,7 @@ #include -#include +#include #include "afb-wsj1.h" #include "afb-ws-json1.h" @@ -37,7 +37,6 @@ #include "afb-xreq.h" #include "afb-context.h" #include "afb-evt.h" -#include "afb-subcall.h" #include "verbose.h" /* predeclaration of structures */ @@ -146,13 +145,13 @@ error: static struct afb_ws_json1 *aws_addref(struct afb_ws_json1 *ws) { - ws->refcount++; + __atomic_add_fetch(&ws->refcount, 1, __ATOMIC_RELAXED); return ws; } static void aws_unref(struct afb_ws_json1 *ws) { - if (--ws->refcount == 0) { + if (!__atomic_sub_fetch(&ws->refcount, 1, __ATOMIC_RELAXED)) { afb_evt_listener_unref(ws->listener); afb_wsj1_unref(ws->wsj1); if (ws->cleanup != NULL)