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

Side by Side Diff: src/once.cc

Issue 303463005: Extract build configuration into a separate header and move it to the base lib (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/lazy-instance.h ('k') | src/platform/mutex.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project 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 "once.h" 5 #include "once.h"
6 6
7 #ifdef _WIN32 7 #ifdef _WIN32
8 #include <windows.h> 8 #include <windows.h>
9 #else 9 #else
10 #include <sched.h> 10 #include <sched.h>
11 #endif 11 #endif
12 12
13 #include "atomicops.h" 13 #include "atomicops.h"
14 #include "checks.h"
15 14
16 namespace v8 { 15 namespace v8 {
17 namespace internal { 16 namespace internal {
18 17
19 void CallOnceImpl(OnceType* once, PointerArgFunction init_func, void* arg) { 18 void CallOnceImpl(OnceType* once, PointerArgFunction init_func, void* arg) {
20 AtomicWord state = Acquire_Load(once); 19 AtomicWord state = Acquire_Load(once);
21 // Fast path. The provided function was already executed. 20 // Fast path. The provided function was already executed.
22 if (state == ONCE_STATE_DONE) { 21 if (state == ONCE_STATE_DONE) {
23 return; 22 return;
24 } 23 }
(...skipping 20 matching lines...) Expand all
45 ::Sleep(0); 44 ::Sleep(0);
46 #else 45 #else
47 sched_yield(); 46 sched_yield();
48 #endif 47 #endif
49 state = Acquire_Load(once); 48 state = Acquire_Load(once);
50 } 49 }
51 } 50 }
52 } 51 }
53 52
54 } } // namespace v8::internal 53 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/lazy-instance.h ('k') | src/platform/mutex.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698