00001 /*
00002 * NOTE: "zlib/libpng" style License
00003 *
00004 * ----=== s t d n e t ===----
00005 *
00006 * Copyright (c) 2002 Warwick Molloy w-molloy@users.sf.net
00007 *
00008 * Copyright (c) 2002 Stdnet Community
00009 * HTTP://Sourceforge.net/projects/stdnet
00010 *
00011 * All references to "software" refer to the stdnet.
00012 *
00013 * This software is provided 'as-is', without any express or
00014 * implied warranty. In no event will the authors be held liable
00015 * for any damages arising from the use of this software.
00016 *
00017 * Permission is granted to anyone to use this software for any
00018 * purpose, including commercial applications, and to alter it
00019 * and redistribute it freely, subject to the following
00020 * restrictions:
00021 *
00022 * 1. The origin of this software must not be misrepresented;
00023 * you must not claim that you wrote the original software.
00024 * If you use this software in a product, an acknowledgment
00025 * in the product documentation would be appreciated but
00026 * is not required.
00027 *
00028 * 2. Altered source versions must be plainly marked as such,
00029 * and must not be misrepresented as being the original
00030 * software.
00031 *
00032 * 3. This notice may not be removed or altered from any source
00033 * distribution.
00034 */
00035
00036 #include <pthread.h>
00037
00038 #ifndef __platform_NativeLock__
00039 #define __platform_NativeLock__
00040
00041 #define __platform_Lock_Type__
00042
00043 namespace stdbase {
00044 namespace system {
00045 namespace platform {
00046
00050 class Lock
00051 {
00052 private:
00053 pthread_mutex_t mutex;
00054 pthread_cond_t condition;
00055 bool locked;
00056
00057 public:
00058 Lock();
00059 ~Lock();
00060
00064 void seize();
00065
00069 void release();
00070
00076 bool trySeize();
00077
00083 void waitSignal();
00084
00094 bool timedWaitSignal( int millisec );
00095
00099 void signal();
00100
00104 void signalAll();
00105 };
00106
00107
00108 } //end namespace platform --
00109 } // -- end namespace system --
00110 } // ------ end namespace stdbase --
00111
00112 #endif // __platform_NativeLock__
00113
1.2.9.1 written by Dimitri van Heesch,
© 1997-2001