equal
deleted
inserted
replaced
42 |
42 |
43 // Wait until all threads that entered a critical section before |
43 // Wait until all threads that entered a critical section before |
44 // synchronization have exited that critical section. |
44 // synchronization have exited that critical section. |
45 void SingleWriterSynchronizer::synchronize() { |
45 void SingleWriterSynchronizer::synchronize() { |
46 // Side-effect in assert balanced by debug-only dec at end. |
46 // Side-effect in assert balanced by debug-only dec at end. |
47 assert(Atomic::add(1u, &_writers) == 1u, "multiple writers"); |
47 assert(Atomic::add(&_writers, 1u) == 1u, "multiple writers"); |
48 // We don't know anything about the muxing between this invocation |
48 // We don't know anything about the muxing between this invocation |
49 // and invocations in other threads. We must start with the latest |
49 // and invocations in other threads. We must start with the latest |
50 // _enter polarity, else we could clobber the wrong _exit value on |
50 // _enter polarity, else we could clobber the wrong _exit value on |
51 // the first iteration. So fence to ensure everything here follows |
51 // the first iteration. So fence to ensure everything here follows |
52 // whatever muxing was used. |
52 // whatever muxing was used. |