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

Unified Diff: third_party/tcmalloc/chromium/src/base/spinlock_posix-inl.h

Issue 7050034: Merge google-perftools r109 (the current contents of third_party/tcmalloc/vendor) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/tcmalloc/chromium/src/base/spinlock_posix-inl.h
===================================================================
--- third_party/tcmalloc/chromium/src/base/spinlock_posix-inl.h (revision 87277)
+++ third_party/tcmalloc/chromium/src/base/spinlock_posix-inl.h (working copy)
@@ -28,25 +28,35 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ---
- * This file is a Posix-specific part of spinlock.cc
+ * This file is a Posix-specific part of spinlock_internal.cc
*/
-#include <sched.h>
-#include <time.h>
+#include <config.h>
+#include <errno.h>
+#ifdef HAVE_SCHED_H
+#include <sched.h> /* For sched_yield() */
+#endif
+#include <time.h> /* For nanosleep() */
-static void SpinLockWait(volatile Atomic32 *w) {
+namespace base {
+namespace internal {
+
+void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop) {
int save_errno = errno;
- struct timespec tm;
- tm.tv_sec = 0;
- tm.tv_nsec = 1000000;
- if (base::subtle::NoBarrier_Load(w) != 0) {
+ if (loop == 0) {
+ } else if (loop == 1) {
sched_yield();
- }
- while (base::subtle::Acquire_CompareAndSwap(w, 0, 1) != 0) {
+ } else {
+ struct timespec tm;
+ tm.tv_sec = 0;
+ tm.tv_nsec = 1000000;
nanosleep(&tm, NULL);
}
errno = save_errno;
}
-static void SpinLockWake(volatile Atomic32 *w) {
+void SpinLockWake(volatile Atomic32 *w, bool all) {
}
+
+} // namespace internal
+} // namespace base

Powered by Google App Engine
This is Rietveld 408576698