4 * Mutual exclusion thread synchonisation 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
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): ______________________________________.
30 * Revision 1.10 2003/09/17 05:41:58 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
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:50 robertj
51 * Changed comments to doc++ compatible documentation.
53 * Revision 1.4 1999/02/16 08:12:22 robertj
54 * MSVC 6.0 compatibility changes.
56 * Revision 1.3 1998/11/30 02:50:59 robertj
57 * New directory structure
59 * Revision 1.2 1998/09/23 06:20:55 robertj
60 * Added open source copyright license.
62 * Revision 1.1 1998/03/23 02:41:31 robertj
74 #include <ptlib/semaphor.h>
77 /**This class defines a thread mutual exclusion object. A mutex is where a
78 piece of code or data cannot be accessed by more than one thread at a time.
79 To prevent this the PMutex is used in the following manner:
87 ... critical section - only one thread at a time here.
93 The first thread will pass through the #Wait()# function, a second
94 thread will block on that function until the first calls the
95 #Signal()# function, releasing the second thread.
97 class PMutex
: public PSemaphore
99 PCLASSINFO(PMutex
, PSemaphore
);
102 /* Create a new mutex.
103 Initially the mutex will not be "set", so the first call to Wait() will
107 PMutex(const PMutex
& mutex
);
109 // Include platform dependent part of class
111 #include "msos/ptlib/mutex.h"
113 #include "unix/ptlib/mutex.h"
119 // End Of File ///////////////////////////////////////////////////////////////