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_SEMAPHORE_H 00034 #define S3_SEMAPHORE_H 00035 00036 #include <semaphore.h> 00037 00068 class s3_semaphore 00069 { 00070 protected: 00074 sem_t sem; 00075 public: 00085 s3_semaphore(int n_value = 0); 00089 ~s3_semaphore(); 00090 // minimise the chances of people blowing off their whole leg in a 00091 // controlled attempt at shooting themselves in the foot 00092 private: 00097 s3_semaphore(const s3_semaphore& src); 00101 s3_semaphore& operator=(const s3_semaphore& src); 00102 public: 00109 void wait() const; 00118 bool try_wait() const; 00125 void post() const; 00130 int get_value() const; 00135 void flush() const; 00136 }; 00137 00138 #endif
Send comments to: s3fc@stonethree.com |
|