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

Side by Side Diff: base/allocator/partition_allocator/spin_lock.cc

Issue 2713903002: Move spin_lock into partition_allocator. (Closed)
Patch Set: Remove unnecessary DEPS line. Created 3 years, 10 months 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 unified diff | Download patch
« no previous file with comments | « base/allocator/partition_allocator/spin_lock.h ('k') | base/synchronization/spin_lock.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/synchronization/spin_lock.h" 5 #include "base/allocator/partition_allocator/spin_lock.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #elif defined(OS_POSIX) 9 #elif defined(OS_POSIX)
10 #include <sched.h> 10 #include <sched.h>
11 #endif 11 #endif
12 12
13 // The YIELD_PROCESSOR macro wraps an architecture specific-instruction that 13 // The YIELD_PROCESSOR macro wraps an architecture specific-instruction that
14 // informs the processor we're in a busy wait, so it can handle the branch more 14 // informs the processor we're in a busy wait, so it can handle the branch more
15 // intelligently and e.g. reduce power to our core or give more resources to the 15 // intelligently and e.g. reduce power to our core or give more resources to the
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 74
75 // Give the OS a chance to schedule something on this core. 75 // Give the OS a chance to schedule something on this core.
76 YIELD_THREAD; 76 YIELD_THREAD;
77 } while (lock_.load(std::memory_order_relaxed)); 77 } while (lock_.load(std::memory_order_relaxed));
78 } while (UNLIKELY(lock_.exchange(true, std::memory_order_acquire))); 78 } while (UNLIKELY(lock_.exchange(true, std::memory_order_acquire)));
79 } 79 }
80 80
81 } // namespace subtle 81 } // namespace subtle
82 } // namespace base 82 } // namespace base
OLDNEW
« no previous file with comments | « base/allocator/partition_allocator/spin_lock.h ('k') | base/synchronization/spin_lock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698