qfastwaitcondition.h

00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Gav Wood                                        *
00003  *   gav@kde.org                                                           *
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                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #ifndef _QT_FASTWAITCONDITION_H
00022 #define _QT_FASTWAITCONDITION_H
00023 
00024 #define HAVE_LINUX
00025 
00026 #ifdef HAVE_LINUX
00027 
00028 #include <qmutex.h>
00029 
00030 #include <sched.h>
00031 
00032 class QFastWaitCondition
00033 {
00034 public:
00035  bool wait(unsigned long  = ULONG_MAX) { sched_yield(); return true; }
00036  bool wait(QMutex * mutex, unsigned long  = ULONG_MAX) { mutex->unlock(); sched_yield(); mutex->lock(); return true; }
00037  void wakeOne() {}
00038  void wakeAll() {}
00039 };
00040 
00041 #else
00042 
00043 #include <qwaitcondition.h>
00044 
00045 typedef QWaitCondition QFastWaitCondition;
00046 
00047 #endif
00048 
00049 #endif

Generated on Thu Jul 13 06:56:33 2006 for Exscalibar by  doxygen 1.4.7