• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- PThreadCondition.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 //  Created by Greg Clayton on 6/16/07.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLDB_TOOLS_DEBUGSERVER_SOURCE_PTHREADCONDITION_H
14 #define LLDB_TOOLS_DEBUGSERVER_SOURCE_PTHREADCONDITION_H
15 
16 #include <pthread.h>
17 
18 class PThreadCondition {
19 public:
PThreadCondition()20   PThreadCondition() { ::pthread_cond_init(&m_condition, NULL); }
21 
~PThreadCondition()22   ~PThreadCondition() { ::pthread_cond_destroy(&m_condition); }
23 
Condition()24   pthread_cond_t *Condition() { return &m_condition; }
25 
Broadcast()26   int Broadcast() { return ::pthread_cond_broadcast(&m_condition); }
27 
Signal()28   int Signal() { return ::pthread_cond_signal(&m_condition); }
29 
30 protected:
31   pthread_cond_t m_condition;
32 };
33 
34 #endif
35