Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
comment++ on that code that I barely understand but exhibits bugs
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 26 Apr 2017 11:56:10 +0000 (13:56 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 26 Apr 2017 11:56:10 +0000 (13:56 +0200)
src/simix/ActorImpl.hpp

index f2a18a6..3e0f707 100644 (file)
@@ -79,6 +79,8 @@ public:
   {
     // inspired from http://www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html
     if (process->refcount_.fetch_sub(1, std::memory_order_release) == 1) {
+      // Make sure that any changes done on other threads before their acquire are commited before our delete
+      // http://stackoverflow.com/questions/27751025/why-is-an-acquire-barrier-needed-before-deleting-the-data-in-an-atomically-refer
       std::atomic_thread_fence(std::memory_order_acquire);
       delete process;
     }