CPN
Computational Process Networks
PthreadCondition.h
Go to the documentation of this file.
1 //=============================================================================
2 // PthreadCondition and PthreadConditionProtected classes
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 
24 #ifndef PthreadCondition_h
25 #define PthreadCondition_h
26 #pragma once
27 
28 #ifdef EXTERNAL_TEMPLATES
29 # pragma interface
30 #endif
31 
32 #include <cpn/common.h>
34 #ifdef _POSIX_THREADS
35 
39 
41  public:
42 
43  PthreadCondition(void);
44  PthreadCondition(const PthreadConditionAttr& condattr);
45  ~PthreadCondition(void);
46 
47  inline operator pthread_cond_t* (void) { return &theCond; }
48 
49  PthreadCondition& Signal(void);
52 
53  // BEWARE! abstime is the time in the future to wake up, not the interval
54  // i.e. usleep(100) is equivalent to: struct timespec ts;
55  // clock_gettime(CLOCK_REALTIME, &ts); ts.tv_nsec += 100000;
56  int TimedWait(PthreadMutex& mutex, const timespec* abstime);
57  int TimedWait(PthreadMutex& mutex, double reltime);
58 
59  private:
60  pthread_cond_t theCond;
61 };
62 
63 
64 #endif
65 #endif
PthreadCondition & Wait(PthreadMutex &mutex)
PthreadCondition & Broadcast(void)
pthread_cond_t theCond
int TimedWait(PthreadMutex &mutex, const timespec *abstime)
PthreadCondition & Signal(void)