PTLib
Version 2.10.10
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
psync.h
Go to the documentation of this file.
1
/*
2
* psync.h
3
*
4
* Abstract synchronisation semaphore class.
5
*
6
* Portable Tools Library
7
*
8
* Copyright (c) 1993-1998 Equivalence Pty. Ltd.
9
* Copyright (c) 2005 Post Increment
10
*
11
* The contents of this file are subject to the Mozilla Public License
12
* Version 1.0 (the "License"); you may not use this file except in
13
* compliance with the License. You may obtain a copy of the License at
14
* http://www.mozilla.org/MPL/
15
*
16
* Software distributed under the License is distributed on an "AS IS"
17
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
18
* the License for the specific language governing rights and limitations
19
* under the License.
20
*
21
* The Original Code is Portable Windows Library.
22
*
23
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24
*
25
* Portions are Copyright (C) 1993 Free Software Foundation, Inc.
26
* All Rights Reserved.
27
*
28
* Contributor(s): ______________________________________.
29
*
30
* $Revision: 27923 $
31
* $Author: rjongbloed $
32
* $Date: 2012-06-27 22:28:36 -0500 (Wed, 27 Jun 2012) $
33
*/
34
35
#ifndef PTLIB_SYNC_H
36
#define PTLIB_SYNC_H
37
38
#ifdef P_USE_PRAGMA
39
#pragma interface
40
#endif
41
42
#include <
ptlib/contain.h
>
43
#include <
ptlib/object.h
>
44
45
class
PSync
:
public
PObject
46
{
47
public
:
52
virtual
void
Wait
() = 0;
53
56
virtual
void
Signal
() = 0;
58
};
59
60
class
PSyncNULL
:
public
PSync
61
{
62
public
:
63
virtual
void
Wait
() { }
64
virtual
void
Signal
() { }
65
};
66
86
class
PWaitAndSignal
{
87
public
:
92
inline
PWaitAndSignal
(
93
const
PSync
& sem,
94
PBoolean
wait =
true
95
) :
sync
((
PSync
&)sem)
96
{
if
(wait)
sync
.
Wait
(); }
97
102
~PWaitAndSignal
()
103
{
sync
.
Signal
(); }
104
105
protected
:
106
PSync
&
sync
;
107
};
108
109
110
#endif // PTLIB_SYNC_H
111
112
113
// End Of File ///////////////////////////////////////////////////////////////
include
ptlib
psync.h
Generated on Mon Mar 4 2013 13:14:09 for PTLib by
1.8.3.1