| OLD | NEW |
| 1 /* Copyright (c) 2010, Google Inc. | 1 /* Copyright (c) 2010, Google Inc. |
| 2 * All rights reserved. | 2 * All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // spin loop on location *w, whose previously observed value was "value". | 37 // spin loop on location *w, whose previously observed value was "value". |
| 38 // SpinLockDelay() may do nothing, may yield the CPU, may sleep a clock tick, | 38 // SpinLockDelay() may do nothing, may yield the CPU, may sleep a clock tick, |
| 39 // or may wait for a delay that can be truncated by a call to SpinlockWake(w). | 39 // or may wait for a delay that can be truncated by a call to SpinlockWake(w). |
| 40 // In all cases, it must return in bounded time even if SpinlockWake() is not | 40 // In all cases, it must return in bounded time even if SpinlockWake() is not |
| 41 // called. | 41 // called. |
| 42 | 42 |
| 43 #include "base/spinlock_internal.h" | 43 #include "base/spinlock_internal.h" |
| 44 | 44 |
| 45 #if defined(_WIN32) | 45 #if defined(_WIN32) |
| 46 #include "base/spinlock_win32-inl.h" | 46 #include "base/spinlock_win32-inl.h" |
| 47 #elif defined(__linux__) | 47 #elif defined(__linux__) && !defined(__native_client__) |
| 48 #include "base/spinlock_linux-inl.h" | 48 #include "base/spinlock_linux-inl.h" |
| 49 #else | 49 #else |
| 50 #include "base/spinlock_posix-inl.h" | 50 #include "base/spinlock_posix-inl.h" |
| 51 #endif | 51 #endif |
| 52 | 52 |
| 53 namespace base { | 53 namespace base { |
| 54 namespace internal { | 54 namespace internal { |
| 55 | 55 |
| 56 // See spinlock_internal.h for spec. | 56 // See spinlock_internal.h for spec. |
| 57 int32 SpinLockWait(volatile Atomic32 *w, int n, | 57 int32 SpinLockWait(volatile Atomic32 *w, int n, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 68 } else if (trans[i].to == v || // null transition | 68 } else if (trans[i].to == v || // null transition |
| 69 base::subtle::Acquire_CompareAndSwap(w, v, trans[i].to) == v) { | 69 base::subtle::Acquire_CompareAndSwap(w, v, trans[i].to) == v) { |
| 70 done = trans[i].done; | 70 done = trans[i].done; |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 return v; | 73 return v; |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace internal | 76 } // namespace internal |
| 77 } // namespace base | 77 } // namespace base |
| OLD | NEW |