CPN
Computational Process Networks
Main Page
Namespaces
Classes
Files
File List
File Members
include
cpn
threading
PthreadErrorHandler.h
Go to the documentation of this file.
1
//=============================================================================
2
// PthreadErrorHandler class
3
//-----------------------------------------------------------------------------
4
// POSIX Pthread class library
5
// Copyright (C) 1997-1999 The University of Texas
6
//
7
// This library is free software; you can redistribute it and/or modify it
8
// under the terms of the GNU Library General Public License as published
9
// by the Free Software Foundation; either version 2 of the License, or
10
// (at your option) any later version.
11
//
12
// This library is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
// Library General Public License for more details.
16
//
17
// The GNU Public License is available in the file LICENSE, or you
18
// can write to the Free Software Foundation, Inc., 59 Temple Place -
19
// Suite 330, Boston, MA 02111-1307, USA, or you can find it on the
20
// World Wide Web at http://www.fsf.org.
21
//=============================================================================
22
23
#ifndef PthreadErrorHandler_h
24
#define PthreadErrorHandler_h
25
#pragma once
26
27
#ifdef EXTERNAL_TEMPLATES
28
# pragma interface
29
#endif
30
31
#include <
cpn/common.h
>
32
#include <
cpn/threading/PthreadDefs.h
>
33
#ifdef _POSIX_THREADS
34
#include <
cpn/utils/ErrnoException.h
>
35
36
class
PthreadErrorHandler
{
37
public
:
38
PthreadErrorHandler
(
void
) {
error
= 0; }
39
int
Error
(
void
) {
return
error
; }
40
void
Clear
(
void
) {
error
= 0; }
41
protected
:
42
void
TrapError
(
int
result);
43
int
error
;
44
};
45
46
47
//-----------------------------------------------------------------------------
48
inline
void
PthreadErrorHandler::TrapError
(
int
err)
49
// If err is nonzero, throw it as an exception.
50
//-----------------------------------------------------------------------------
51
{
52
if
(err) {
53
error
= err;
54
throw
ErrnoException
(err);
55
}
56
}
57
58
59
#endif
60
#endif
PthreadErrorHandler::Error
int Error(void)
Definition:
PthreadErrorHandler.h:39
PthreadErrorHandler::PthreadErrorHandler
PthreadErrorHandler(void)
Definition:
PthreadErrorHandler.h:38
ErrnoException
Definition:
ErrnoException.h:37
PthreadDefs.h
PthreadErrorHandler::error
int error
Definition:
PthreadErrorHandler.h:43
PthreadErrorHandler::TrapError
void TrapError(int result)
Definition:
PthreadErrorHandler.h:48
common.h
ErrnoException.h
PthreadErrorHandler::Clear
void Clear(void)
Definition:
PthreadErrorHandler.h:40
PthreadErrorHandler
Definition:
PthreadErrorHandler.h:36
Generated by
1.8.5