S3FC project page | S3FC home page |
00001 /* 00002 * Stone Three Foundation Class (s3fc) provides a number of utility classes. 00003 * Copyright (C) 2001 by Stone Three Signal Processing (Pty) Ltd. 00004 * 00005 * Authored by Stone Three Signal Processing (Pty) Ltd. 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * Please see the file 'COPYING' in the source root directory. 00022 */ 00023 00033 #ifndef S3_MUTEX_H 00034 #define S3_MUTEX_H 00035 00036 #include <pthread.h> 00037 00038 // forward decl to facilitate friend 00039 class s3_condition; 00040 00075 class s3_mutex 00076 { 00077 // condition requires the underlying pthread_mutex_t 00078 friend class s3_condition; 00079 protected: 00083 mutable pthread_mutex_t mutex; 00084 public: 00088 s3_mutex(); 00092 ~s3_mutex(); 00093 protected: 00098 s3_mutex(const s3_mutex& src); 00102 s3_mutex& operator=(const s3_mutex& src); 00103 public: 00108 void lock() const; 00117 bool try_lock() const; 00122 void unlock() const; 00123 }; 00124 00125 00126 #endif
Send comments to: s3fc@stonethree.com |
|