Ignore:
Timestamp:
Sep 26, 2019, 4:25:04 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
1e24d13
Parents:
b2a37b0
Message:

Small tweaks to the memory layout

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/thierry_delisle_PhD/code/processor_list.hpp

    rb2a37b0 r50aeb6f  
    188188        }
    189189
     190        //-----------------------------------------------------------------------
     191        // Checking support
     192        uint_fast32_t epoch_check() {
     193                // Step 1 : lock global lock
     194                // It is needed to avoid processors that register mid Critical-Section
     195                //   to simply lock their own lock and enter.
     196                while(lock.load(std::memory_order_relaxed))
     197                        asm volatile("pause");
     198
     199                // Step 2 : lock per-proc lock
     200                // Processors that are currently being registered aren't counted
     201                //   but can't be in read_lock or in the critical section.
     202                // All other processors are counted
     203                uint_fast32_t s = ready;
     204                for(uint_fast32_t i = 0; i < s; i++) {
     205                        while(data[i].lock.load(std::memory_order_relaxed))
     206                                asm volatile("pause");
     207                }
     208
     209                return s;
     210        }
     211
    190212public:
    191213};
Note: See TracChangeset for help on using the changeset viewer.