Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

ObjLock.h

Go to the documentation of this file.
00001 #ifndef __ObjLock_h__
00002 #define __ObjLock_h__
00003 /* Copyright (C) 2003 Herbert Straub
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018  */
00019 #include <string>
00020 #ifndef USE_FLOCK
00021 #include <fcntl.h>
00022 #endif
00023 
00032 class ObjLock {
00033       public:
00037         ObjLock(const string & name);
00038 
00040         ~ObjLock();
00041 
00042         enum { locked, not_locked };
00043 
00046         void lockShBlk(void);
00047 
00051         int lockShNoBlk(void);
00052 
00055         void lockExBlk(void);
00056 
00060         int lockExNoBlk(void);
00061 
00064         void unlock(void);
00065 
00066       private:
00067          string name;
00068         int fd;
00069 #ifndef USE_FLOCK
00070         struct flock l;
00071 #endif
00072 
00073 };
00074 
00075 #endif

Generated on Fri Aug 20 10:58:08 2004 for NewsCache by doxygen 1.3.6-20040222