celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [celix] abroekhuis commented on a change in pull request #224: Fixes an potential race condition issues with the creation of service ids
Date Wed, 06 May 2020 06:02:56 GMT

abroekhuis commented on a change in pull request #224:
URL: https://github.com/apache/celix/pull/224#discussion_r420561681



##########
File path: libs/framework/src/service_registry.c
##########
@@ -1215,4 +1215,9 @@ static void celix_waitForPendingRegisteredEvents(celix_service_registry_t
*regis
         count = (long)hashMap_get(registry->pendingRegisterEvents.map, (void*)svcId);
     }
     celixThreadMutex_unlock(&registry->pendingRegisterEvents.mutex);
+}
+
+long celix_serviceRegistry_nextSvcId(celix_service_registry_t* registry) {
+    long scvId = __atomic_fetch_add(&registry->nextServiceId, 1, __ATOMIC_SEQ_CST);

Review comment:
       If I am right, this return 0. "These built-in functions perform the operation suggested
by the name, and return the value that had previously been in *ptr".
   So now instead of starting at 1, we start at 0? I don't think this introduces some error,
just curious.




----------------------------------------------------------------
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