Chris@109: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@109: Chris@109: /* Chris@109: Sonic Visualiser Chris@109: An audio file viewer and annotation editor. Chris@109: Centre for Digital Music, Queen Mary, University of London. Chris@109: This file copyright 2006 Chris Cannam. Chris@109: Chris@109: This program is free software; you can redistribute it and/or Chris@109: modify it under the terms of the GNU General Public License as Chris@109: published by the Free Software Foundation; either version 2 of the Chris@109: License, or (at your option) any later version. See the file Chris@109: COPYING included with this distribution for more information. Chris@109: */ Chris@109: Chris@109: #ifndef _THREAD_H_ Chris@109: #define _THREAD_H_ Chris@109: Chris@109: #include Chris@244: #include Chris@109: Chris@408: #include "Profiler.h" Chris@408: Chris@109: class Thread : public QThread Chris@109: { Chris@109: Q_OBJECT Chris@109: Chris@109: public: Chris@109: enum Type { RTThread, NonRTThread }; Chris@109: Chris@109: Thread(Type type = NonRTThread, QObject *parent = 0); Chris@109: Chris@109: public slots: Chris@109: void start(); Chris@109: Chris@392: protected: Chris@392: virtual void run() = 0; Chris@392: Chris@109: private: Chris@109: Type m_type; Chris@109: }; Chris@109: Chris@244: class MutexLocker Chris@244: { Chris@244: public: Chris@244: MutexLocker(QMutex *mutex, const char *name); Chris@244: ~MutexLocker(); Chris@244: Chris@244: private: Chris@244: class Printer { Chris@244: public: Chris@244: Printer(const char *name); Chris@244: ~Printer(); Chris@244: Chris@244: private: Chris@244: const char *m_name; Chris@244: }; Chris@244: Chris@408: Profiler m_profiler; Chris@244: Printer m_printer; Chris@244: QMutexLocker m_locker; Chris@244: }; Chris@244: Chris@109: #endif