pnoltes commented on pull request #214:
URL: https://github.com/apache/celix/pull/214#issuecomment-623075033


   If we introduce atomic, then I prefer that we use the c11 standard stuff for 
that.
   
   This means update the top level cmake lists file to use -std=c11 instead of 
-std=gnu99 and
   use the function in <stdatomic.h> instead of gcc builtins.
   
   Something like:
   ```C
   //bundle_private.h
   ...
   #include <sdtatomic.h>
   ...
   struct celix_bundle {
        bundle_context_pt context;
       char *symbolicName; //for debug
        struct celix_bundle_activator *activator;
        _Atomic(bundle_state_e) state;
        void * handle;
        bundle_archive_pt archive;
        array_list_pt modules;
        manifest_pt manifest;
   
        celix_framework_t *framework;
   };
   
   //bundle.c
   ...
   (*bundle)->state = ATOMIC_VAR_INIT(OSGI_FRAMEWORK_BUNDLE_INSTALLED);
   ...
   state = atomic_load_explicit(&bundle->state, __ATOMIC_ACQUIRE);
   ...
   atomic_store_explicit(&bundle->state, state, __ATOMIC_RELEASE);
   ...
   ``` 
   
   This also means we bump the required compiler from gnu99 compatible to c11 
compatible. 
   Seeing that it is 2020 I have no problem with that. 
   @abroekhuis, @rlenferink and @rbulter WDYT?


----------------------------------------------------------------
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:
[email protected]


Reply via email to