Made some subtle changes to the way the static variables are instantiated in
[pwlib.git] / include / ptlib / syncpoint.h
blobc50ee3a878b0360444cfe66335c72028dc27b32b
1 /*
2 * syncpoint.h
4 * Single thread synchronisation point (event) class.
6 * Portable Windows Library
8 * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
18 * under the License.
20 * The Original Code is Portable Windows Library.
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25 * All Rights Reserved.
27 * Contributor(s): ______________________________________.
29 * $Log$
30 * Revision 1.10 2003/09/17 05:41:59 csoutheren
31 * Removed recursive includes
33 * Revision 1.9 2003/09/17 01:18:02 csoutheren
34 * Removed recursive include file system and removed all references
35 * to deprecated coooperative threading support
37 * Revision 1.8 2002/09/16 01:08:59 robertj
38 * Added #define so can select if #pragma interface/implementation is used on
39 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
41 * Revision 1.7 2002/01/23 04:26:36 craigs
42 * Added copy constructors for PSemaphore, PMutex and PSyncPoint to allow
43 * use of default copy constructors for objects containing instances of
44 * these classes
46 * Revision 1.6 2001/05/22 12:49:32 robertj
47 * Did some seriously wierd rewrite of platform headers to eliminate the
48 * stupid GNU compiler warning about braces not matching.
50 * Revision 1.5 1999/03/09 02:59:51 robertj
51 * Changed comments to doc++ compatible documentation.
53 * Revision 1.4 1999/02/16 08:11:17 robertj
54 * MSVC 6.0 compatibility changes.
56 * Revision 1.3 1998/11/30 02:52:00 robertj
57 * New directory structure
59 * Revision 1.2 1998/09/23 06:21:34 robertj
60 * Added open source copyright license.
62 * Revision 1.1 1998/03/23 02:41:34 robertj
63 * Initial revision
67 #ifndef _PSYNCPOINT
68 #define _PSYNCPOINT
70 #ifdef P_USE_PRAGMA
71 #pragma interface
72 #endif
74 #include <ptlib/semaphor.h>
77 /** This class defines a thread synchonisation object.
78 This form of semaphore is used to indicate an {\it event} has occurred. A
79 thread may block on theis sync point and wait until another thread signals
80 that it may continue. eg:
81 \begin{verbatim}
82 ... thread one
83 while (condition) {
84 sync.Wait();
85 do_something();
88 ... thread 2
89 do_something_else();
90 sync.Signal(); // At this point thread 1 wake up and does something.
91 do_yet_more();
93 \end{verbatim}
95 class PSyncPoint : public PSemaphore
97 PCLASSINFO(PSyncPoint, PSemaphore);
99 public:
100 /** Create a new sync point.
102 PSyncPoint();
103 PSyncPoint(const PSyncPoint &);
106 // Include platform dependent part of class
107 #ifdef _WIN32
108 #include "msos/ptlib/syncpoint.h"
109 #else
110 #include "unix/ptlib/syncpoint.h"
111 #endif
114 #endif
117 // End Of File ///////////////////////////////////////////////////////////////