ONPOSIX
2.0
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Enumerator
Friends
Macros
Pages
PosixCondition.cpp
Go to the documentation of this file.
1
/*
2
* PosixCondition.cpp
3
*
4
* Copyright (C) 2012 Evidence Srl - www.evidence.eu.com
5
*
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Library General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
10
*
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Library General Public License for more details.
15
*
16
* You should have received a copy of the GNU Library General Public
17
* License along with this library; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
21
#include "
PosixCondition.hpp
"
22
#include "
Assert.hpp
"
23
#include <errno.h>
24
#include <string.h>
25
#include <stdexcept>
26
27
namespace
onposix {
28
29
/**
30
* \brief Constructor. Initialize the condition variable.
31
*
32
* @exception runtime_error if the initialization of the condition variable
33
* fails.
34
*/
35
PosixCondition::PosixCondition
()
36
{
37
if
(pthread_cond_init(&
cond_
, NULL) != 0)
38
throw
std::runtime_error(std::string(
"Error: "
) + strerror(errno));
39
}
40
41
/**
42
* \brief Destructor. Destroys the condition variable.
43
*/
44
PosixCondition::~PosixCondition
()
45
{
46
VERIFY_ASSERTION
(!pthread_cond_destroy(&
cond_
));
47
}
48
49
}
/* onposix */
50
51
52
53
54
55
56
57
src
PosixCondition.cpp
Generated on Wed Apr 30 2014 15:27:24 for ONPOSIX by
1.8.1.2