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

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

Issue 1961893002: Instrument callers of Semaphore::Signal to help with investigation of (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/base/platform/semaphore.cc » ('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 #ifndef V8_BASE_PLATFORM_SEMAPHORE_H_ 5 #ifndef V8_BASE_PLATFORM_SEMAPHORE_H_
6 #define V8_BASE_PLATFORM_SEMAPHORE_H_ 6 #define V8_BASE_PLATFORM_SEMAPHORE_H_
7 7
8 #include "src/base/lazy-instance.h" 8 #include "src/base/lazy-instance.h"
9 #if V8_OS_WIN 9 #if V8_OS_WIN
10 #include "src/base/win32-headers.h" 10 #include "src/base/win32-headers.h"
(...skipping 19 matching lines...) Expand all
30 // object and incremented each time a thread signals the semaphore. When the 30 // object and incremented each time a thread signals the semaphore. When the
31 // count reaches zero, threads waiting for the semaphore blocks until the 31 // count reaches zero, threads waiting for the semaphore blocks until the
32 // count becomes non-zero. 32 // count becomes non-zero.
33 33
34 class Semaphore final { 34 class Semaphore final {
35 public: 35 public:
36 explicit Semaphore(int count); 36 explicit Semaphore(int count);
37 ~Semaphore(); 37 ~Semaphore();
38 38
39 // Increments the semaphore counter. 39 // Increments the semaphore counter.
40 void Signal(); 40 // TODO(ulan): remove caller parameter once crbug.com/609249 is fixed.
41 void Signal(const char* caller = nullptr);
41 42
42 // Suspends the calling thread until the semaphore counter is non zero 43 // Suspends the calling thread until the semaphore counter is non zero
43 // and then decrements the semaphore counter. 44 // and then decrements the semaphore counter.
44 void Wait(); 45 void Wait();
45 46
46 // Suspends the calling thread until the counter is non zero or the timeout 47 // Suspends the calling thread until the counter is non zero or the timeout
47 // time has passed. If timeout happens the return value is false and the 48 // time has passed. If timeout happens the return value is false and the
48 // counter is unchanged. Otherwise the semaphore counter is decremented and 49 // counter is unchanged. Otherwise the semaphore counter is decremented and
49 // true is returned. 50 // true is returned.
50 bool WaitFor(const TimeDelta& rel_time) WARN_UNUSED_RESULT; 51 bool WaitFor(const TimeDelta& rel_time) WARN_UNUSED_RESULT;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 typedef typename LazyDynamicInstance<Semaphore, CreateSemaphoreTrait<N>, 94 typedef typename LazyDynamicInstance<Semaphore, CreateSemaphoreTrait<N>,
94 ThreadSafeInitOnceTrait>::type type; 95 ThreadSafeInitOnceTrait>::type type;
95 }; 96 };
96 97
97 #define LAZY_SEMAPHORE_INITIALIZER LAZY_DYNAMIC_INSTANCE_INITIALIZER 98 #define LAZY_SEMAPHORE_INITIALIZER LAZY_DYNAMIC_INSTANCE_INITIALIZER
98 99
99 } // namespace base 100 } // namespace base
100 } // namespace v8 101 } // namespace v8
101 102
102 #endif // V8_BASE_PLATFORM_SEMAPHORE_H_ 103 #endif // V8_BASE_PLATFORM_SEMAPHORE_H_
OLDNEW
« no previous file with comments | « no previous file | src/base/platform/semaphore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698