| OLD | NEW |
| 1 /* Copyright (c) 2009, Google Inc. | 1 /* Copyright (c) 2009, 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 namespace internal { | 42 namespace internal { |
| 43 | 43 |
| 44 void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop) { | 44 void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop) { |
| 45 int save_errno = errno; | 45 int save_errno = errno; |
| 46 if (loop == 0) { | 46 if (loop == 0) { |
| 47 } else if (loop == 1) { | 47 } else if (loop == 1) { |
| 48 sched_yield(); | 48 sched_yield(); |
| 49 } else { | 49 } else { |
| 50 struct timespec tm; | 50 struct timespec tm; |
| 51 tm.tv_sec = 0; | 51 tm.tv_sec = 0; |
| 52 tm.tv_nsec = 1000000; | 52 tm.tv_nsec = base::internal::SuggestedDelayNS(loop); |
| 53 nanosleep(&tm, NULL); | 53 nanosleep(&tm, NULL); |
| 54 } | 54 } |
| 55 errno = save_errno; | 55 errno = save_errno; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void SpinLockWake(volatile Atomic32 *w, bool all) { | 58 void SpinLockWake(volatile Atomic32 *w, bool all) { |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace internal | 61 } // namespace internal |
| 62 } // namespace base | 62 } // namespace base |
| OLD | NEW |