celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [celix] Oipo commented on a change in pull request #245: Bugfix/data races
Date Mon, 08 Jun 2020 09:36:07 GMT

Oipo commented on a change in pull request #245:
URL: https://github.com/apache/celix/pull/245#discussion_r436571355



##########
File path: bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_handler.c
##########
@@ -180,13 +180,8 @@ pubsub_tcpHandler_t *pubsub_tcpHandler_create(pubsub_protocol_service_t
*protoco
 //
 void pubsub_tcpHandler_destroy(pubsub_tcpHandler_t *handle) {
     if (handle != NULL) {
-        celixThreadRwlock_readLock(&handle->dbLock);
-        bool running = handle->running;
-        celixThreadRwlock_unlock(&handle->dbLock);
-        if (running) {
-            celixThreadRwlock_writeLock(&handle->dbLock);
-            handle->running = false;
-            celixThreadRwlock_unlock(&handle->dbLock);
+        if (__atomic_load_n(&handle->running, __ATOMIC_ACQUIRE)) {
+            __atomic_store_n(&handle->running, false, __ATOMIC_RELEASE);

Review comment:
       Hmm? The check is still there?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message