src/hotspot/share/utilities/singleWriterSynchronizer.hpp
changeset 59249 29b0d0b61615
parent 52332 d2a3503c72f7
equal deleted inserted replaced
59248:e92153ed8bdc 59249:29b0d0b61615
    87   // RAII class for managing enter/exit pairs.
    87   // RAII class for managing enter/exit pairs.
    88   class CriticalSection;
    88   class CriticalSection;
    89 };
    89 };
    90 
    90 
    91 inline uint SingleWriterSynchronizer::enter() {
    91 inline uint SingleWriterSynchronizer::enter() {
    92   return Atomic::add(2u, &_enter);
    92   return Atomic::add(&_enter, 2u);
    93 }
    93 }
    94 
    94 
    95 inline void SingleWriterSynchronizer::exit(uint enter_value) {
    95 inline void SingleWriterSynchronizer::exit(uint enter_value) {
    96   uint exit_value = Atomic::add(2u, &_exit[enter_value & 1]);
    96   uint exit_value = Atomic::add(&_exit[enter_value & 1], 2u);
    97   // If this exit completes a synchronize request, wakeup possibly
    97   // If this exit completes a synchronize request, wakeup possibly
    98   // waiting synchronizer.  Read of _waiting_for must follow the _exit
    98   // waiting synchronizer.  Read of _waiting_for must follow the _exit
    99   // update.
    99   // update.
   100   if (exit_value == _waiting_for) {
   100   if (exit_value == _waiting_for) {
   101     _wakeup.signal();
   101     _wakeup.signal();