Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Unified Diff: webrtc/base/criticalsection.cc

Issue 1498953002: Reland of "Create rtc::AtomicInt POD struct." (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: initializer to audio_device_ios.mm Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/criticalsection.h ('k') | webrtc/base/refcount.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/criticalsection.cc
diff --git a/webrtc/base/criticalsection.cc b/webrtc/base/criticalsection.cc
index 1f50c2355dbcef57b016f31dcc8c68501b9a84ca..97322f45c9368b64d7f4fae24ca3a5f56aaee260 100644
--- a/webrtc/base/criticalsection.cc
+++ b/webrtc/base/criticalsection.cc
@@ -139,7 +139,7 @@ void GlobalLockPod::Lock() {
const struct timespec ts_null = {0};
#endif
- while (AtomicOps::CompareAndSwap(&lock_acquired, 0, 1)) {
+ while (AtomicInt::CompareAndSwap(&lock_acquired, 0, 1)) {
#if defined(WEBRTC_WIN)
::Sleep(0);
#else
@@ -149,16 +149,13 @@ void GlobalLockPod::Lock() {
}
void GlobalLockPod::Unlock() {
- int old_value = AtomicOps::CompareAndSwap(&lock_acquired, 1, 0);
+ int old_value = AtomicInt::CompareAndSwap(&lock_acquired, 1, 0);
RTC_DCHECK_EQ(1, old_value) << "Unlock called without calling Lock first";
}
-GlobalLock::GlobalLock() {
- lock_acquired = 0;
-}
+GlobalLock::GlobalLock() : GlobalLockPod({{0}}) {}
-GlobalLockScope::GlobalLockScope(GlobalLockPod* lock)
- : lock_(lock) {
+GlobalLockScope::GlobalLockScope(GlobalLockPod* lock) : lock_(lock) {
lock_->Lock();
}
« no previous file with comments | « webrtc/base/criticalsection.h ('k') | webrtc/base/refcount.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698