xref: /freebsd/contrib/llvm-project/compiler-rt/lib/scudo/standalone/condition_variable_linux.h (revision aa1a8ff2d6dbc51ef058f46f3db5a8bb77967145)
1 //===-- condition_variable_linux.h ------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef SCUDO_CONDITION_VARIABLE_LINUX_H_
10 #define SCUDO_CONDITION_VARIABLE_LINUX_H_
11 
12 #include "platform.h"
13 
14 #if SCUDO_LINUX
15 
16 #include "atomic_helpers.h"
17 #include "condition_variable_base.h"
18 #include "thread_annotations.h"
19 
20 namespace scudo {
21 
22 class ConditionVariableLinux
23     : public ConditionVariableBase<ConditionVariableLinux> {
24 public:
25   void notifyAllImpl(HybridMutex &M) REQUIRES(M);
26 
27   void waitImpl(HybridMutex &M) REQUIRES(M);
28 
29 private:
30   u32 LastNotifyAll = 0;
31   atomic_u32 Counter = {};
32 };
33 
34 } // namespace scudo
35 
36 #endif // SCUDO_LINUX
37 
38 #endif // SCUDO_CONDITION_VARIABLE_LINUX_H_
39