]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tools/debugserver/source/PThreadCondition.h
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / tools / debugserver / source / PThreadCondition.h
1 //===-- PThreadCondition.h --------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //  Created by Greg Clayton on 6/16/07.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef __PThreadCondition_h__
15 #define __PThreadCondition_h__
16
17 #include <pthread.h>
18
19 class PThreadCondition {
20 public:
21   PThreadCondition() { ::pthread_cond_init(&m_condition, NULL); }
22
23   ~PThreadCondition() { ::pthread_cond_destroy(&m_condition); }
24
25   pthread_cond_t *Condition() { return &m_condition; }
26
27   int Broadcast() { return ::pthread_cond_broadcast(&m_condition); }
28
29   int Signal() { return ::pthread_cond_signal(&m_condition); }
30
31 protected:
32   pthread_cond_t m_condition;
33 };
34
35 #endif