From: Christian P. <cp...@us...> - 2005-05-06 15:21:13
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9502/include/pclasses Modified Files: AtomicTraits.h Added Files: CoreMutex.h Log Message: - Renamed AtomicMutex to CoreMutex. We need a mutex in the core module for thread-safety. Index: AtomicTraits.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/AtomicTraits.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- AtomicTraits.h 23 Apr 2005 11:59:08 -0000 1.5 +++ AtomicTraits.h 6 May 2005 15:21:01 -0000 1.6 @@ -21,40 +21,14 @@ #ifndef P_AtomicTraits_h #define P_AtomicTraits_h +#include <pclasses/pclasses-config.h> #include <pclasses/Export.h> +#include <pclasses/CoreMutex.h> namespace P { namespace Traits { -//! AtomicMutex -/*! - The AtomicMutex class is used by the default implementation of - AtomicTraits<> to provide atomicity for types that dont have a - AtomicTraits specialisation. -*/ -class PCORE_EXPORT AtomicMutex { - public: - AtomicMutex(); - ~AtomicMutex(); - - void lock() throw(); - void unlock() throw(); - - class ScopedLock { - public: - ScopedLock(AtomicMutex& mtx); - ~ScopedLock(); - - private: - AtomicMutex& _mtx; - }; - - private: - unsigned long _handle; -}; - - //! Atomic traits /*! The AtomicTraits template supplies the actual implementation for the @@ -66,6 +40,8 @@ template <class Type> struct AtomicTraits { + typedef CoreMutex AtomicMutex; + struct AtomicType { Type value; AtomicMutex lock; --- NEW FILE: CoreMutex.h --- /*************************************************************************** * Copyright (C) 2004,2005 by Christian Prochnow, SecuLogiX GmbH * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef P_CoreMutex_h #define P_CoreMutex_h #include <pclasses/Export.h> #include <pclasses/NonCopyable.h> namespace P { //! CoreMutex /*! The CoreMutex class is a minimalistic Mutex class used by the P::Classes Core module where locking is necessary. */ class PCORE_EXPORT CoreMutex: public NonCopyable { public: CoreMutex(); ~CoreMutex(); void lock() throw(); void unlock() throw(); class ScopedLock: public NonCopyable { public: ScopedLock(CoreMutex& mtx); ~ScopedLock(); private: CoreMutex& _mtx; }; private: unsigned long _handle; }; } // !namespace P #endif |