blob: 787cc7941d524207afc6ae0bc72cd02e6d61606a [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001//===-- 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
19class PThreadCondition
20{
21public:
22
23 PThreadCondition()
24 {
25 ::pthread_cond_init (&m_condition, NULL);
26 }
27
28 ~PThreadCondition()
29 {
30 ::pthread_cond_destroy (&m_condition);
31 }
32
33 pthread_cond_t *Condition()
34 {
35 return &m_condition;
36 }
37
38 int Broadcast()
39 {
40 return ::pthread_cond_broadcast (&m_condition);
41 }
42
43 int Signal()
44 {
45 return ::pthread_cond_signal (&m_condition);
46 }
47
48protected:
49 pthread_cond_t m_condition;
50};
51
52#endif
53