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

Side by Side Diff: src/base/platform/semaphore.cc

Issue 2080223006: [wasm] Move the semaphore for parallel compilation to the wasm module. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Adjusted a comment. Created 4 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
« no previous file with comments | « no previous file | src/wasm/wasm-module.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 "src/base/platform/semaphore.h" 5 #include "src/base/platform/semaphore.h"
6 6
7 #if V8_OS_MACOSX 7 #if V8_OS_MACOSX
8 #include <mach/mach_init.h> 8 #include <mach/mach_init.h>
9 #include <mach/task.h> 9 #include <mach/task.h>
10 #endif 10 #endif
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 95
96 Semaphore::~Semaphore() { 96 Semaphore::~Semaphore() {
97 int result = sem_destroy(&native_handle_); 97 int result = sem_destroy(&native_handle_);
98 DCHECK_EQ(0, result); 98 DCHECK_EQ(0, result);
99 USE(result); 99 USE(result);
100 } 100 }
101 101
102 void Semaphore::Signal() { 102 void Semaphore::Signal() {
103 int result = sem_post(&native_handle_); 103 int result = sem_post(&native_handle_);
104 // This check may fail with <libc-2.21, which we use on the try bots, if the
105 // semaphore is destroyed while sem_post is still executed. A work around is
106 // to extend the lifetime of the semaphore.
104 CHECK_EQ(0, result); 107 CHECK_EQ(0, result);
105 } 108 }
106 109
107 110
108 void Semaphore::Wait() { 111 void Semaphore::Wait() {
109 while (true) { 112 while (true) {
110 int result = sem_wait(&native_handle_); 113 int result = sem_wait(&native_handle_);
111 if (result == 0) return; // Semaphore was signalled. 114 if (result == 0) return; // Semaphore was signalled.
112 // Signal caused spurious wakeup. 115 // Signal caused spurious wakeup.
113 DCHECK_EQ(-1, result); 116 DCHECK_EQ(-1, result);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 DCHECK(result == WAIT_OBJECT_0); 208 DCHECK(result == WAIT_OBJECT_0);
206 return true; 209 return true;
207 } 210 }
208 } 211 }
209 } 212 }
210 213
211 #endif // V8_OS_MACOSX 214 #endif // V8_OS_MACOSX
212 215
213 } // namespace base 216 } // namespace base
214 } // namespace v8 217 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/wasm/wasm-module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698