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
18class PThreadCondition {
19public:
20  PThreadCondition() { ::pthread_cond_init(&m_condition, NULL); }
21
22  ~PThreadCondition() { ::pthread_cond_destroy(&m_condition); }
23
24  pthread_cond_t *Condition() { return &m_condition; }
25
26  int Broadcast() { return ::pthread_cond_broadcast(&m_condition); }
27
28  int Signal() { return ::pthread_cond_signal(&m_condition); }
29
30protected:
31  pthread_cond_t m_condition;
32};
33
34#endif
35