KDevelop API Documentation

kdevmutex.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Definition of QMutex class
00004 **
00005 ** Created : 931107
00006 **
00007 ** Copyright (C) 1992-2002 Trolltech AS.  All rights reserved.
00008 **
00009 ** This file is part of the tools module of the Qt GUI Toolkit.
00010 **
00011 ** This file may be distributed under the terms of the Q Public License
00012 ** as defined by Trolltech AS of Norway and appearing in the file
00013 ** LICENSE.QPL included in the packaging of this file.
00014 **
00015 ** This file may be distributed and/or modified under the terms of the
00016 ** GNU General Public License version 2 as published by the Free Software
00017 ** Foundation and appearing in the file LICENSE.GPL included in the
00018 ** packaging of this file.
00019 **
00020 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00021 ** licenses may use this file in accordance with the Qt Commercial License
00022 ** Agreement provided with the Software.
00023 **
00024 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00025 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00026 **
00027 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00028 **   information about Qt Commercial License Agreements.
00029 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00030 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00031 **
00032 ** Contact info@trolltech.com if any conditions of this licensing are
00033 ** not clear to you.
00034 **
00035 **********************************************************************/
00036 
00037 #ifndef KDEVMUTEX_H
00038 #define KDEVMUTEX_H
00039 
00040 #include "qglobal.h"
00041 
00042 // no namespace needed since it is a build-time dependency
00043 
00044 #if QT_VERSION < 0x030100
00045 
00046 #include <qmutex.h>
00047 
00048 class QMutexLocker
00049 {
00050 public:
00051     QMutexLocker( QMutex * );
00052     ~QMutexLocker();
00053 
00054     QMutex *mutex() const;
00055 
00056 private:
00057     QMutex *mtx;
00058 
00059 #if defined(Q_DISABLE_COPY)
00060     QMutexLocker( const QMutexLocker & );
00061     QMutexLocker &operator=( const QMutexLocker & );
00062 #endif
00063 };
00064 
00065 inline QMutexLocker::QMutexLocker( QMutex *m )
00066     : mtx( m )
00067 {
00068     if ( mtx ) mtx->lock();
00069 }
00070 
00071 inline QMutexLocker::~QMutexLocker()
00072 {
00073     if ( mtx ) mtx->unlock();
00074 }
00075 
00076 inline QMutex *QMutexLocker::mutex() const
00077 {
00078     return mtx;
00079 }
00080 
00081 #endif // QT_VERSION
00082 
00083 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:34 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003