00001 #ifndef READER_WRITER_LOCK_CLASS 00002 #define READER_WRITER_LOCK_CLASS 00003 00004 /*****************************************************************************\ 00005 * * 00006 * Name : reader_writer_lock * 00007 * Author : Chris Koeritz * 00008 * * 00009 ******************************************************************************* 00010 * Copyright (c) 1998-$now By Author. This program is free software; you can * 00011 * redistribute it and/or modify it under the terms of the GNU General Public * 00012 * License as published by the Free Software Foundation; either version 2 of * 00013 * the License or (at your option) any later version. This is online at: * 00014 * http://www.fsf.org/copyleft/gpl.html * 00015 * Please send any updates to: fred@gruntose.com * 00016 \*****************************************************************************/ 00017 00018 #include "mechanisms_dll.h" 00019 00020 #include <basis/object_base.h> 00021 00023 00033 class MECHANISMS_CLASS_STYLE reader_writer_lock 00034 { 00035 public: 00036 reader_writer_lock(); 00037 virtual ~reader_writer_lock(); 00038 00039 IMPLEMENT_CLASS_NAME("reader_writer_lock"); 00040 00041 void begin_read(); 00043 00047 void end_read(); 00049 00050 void begin_write(); 00052 00055 void end_write(); 00056 00057 private: 00058 mutex *_write_lock; 00059 int _reader_count; 00060 mutex *_variable_lock; 00061 }; 00062 00063 #endif 00064
1.5.1