Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

concurrence.hpp

Go to the documentation of this file.
00001 /*
00002  * Equation Cruncher
00003  * Copyright (C) 2004  Dhruv Matani(dhruvbird@yahoo.com)
00004  * 
00005  * 
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License as
00008  * published by the Free Software Foundation; either version 2 of the
00009  * License, or (at your option) any later version.
00010  * 
00011  * This program is distributed in the hope that it will be useful, but
00012  * WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00019  * USA
00020  */
00021 
00022 
00023 #if !defined EC_CONCURRENCE_HPP
00024 #define EC_CONCURRENCE_HPP
00025 
00026 #include <pthread.h>
00027 
00035 namespace eqn_cruncher
00036 {
00040   class pthr_lock
00041   {
00042     pthread_mutex_t _mut;
00043     pthr_lock(const pthr_lock&);
00044     pthr_lock& operator=(const pthr_lock&);
00045 
00046   public:
00050     pthr_lock()
00051     {
00052       pthread_mutex_init(&_mut, NULL);
00053     }
00054 
00059     ~pthr_lock()
00060     {
00061       pthread_mutex_destroy(&_mut);
00062     }
00063 
00067     void
00068     lock()
00069     {
00070       pthread_mutex_lock(&_mut);
00071     }
00072 
00076     void
00077     unlock()
00078     {
00079       pthread_mutex_unlock(&_mut);
00080     }
00081   };
00082 }
00083 
00084 #endif // EC_CONCURRENCE_H

Generated on Mon Oct 11 13:09:25 2004 for Equation Cruncher by doxygen1.2.18