comparison base/Thread.cpp @ 244:85bf384db35f

* Update to use new vamp-hostsdk instead of vamp-sdk * Make spectrogram adapt its paint block size depending on how long it actually takes to draw * Some thread debugging infrastructure
author Chris Cannam
date Fri, 02 Mar 2007 13:01:41 +0000
parents 61a2ac1241b3
children 115f60df1e4d
comparison
equal deleted inserted replaced
243:ff46f251139e 244:85bf384db35f
16 #include "Thread.h" 16 #include "Thread.h"
17 17
18 #ifndef _WIN32 18 #ifndef _WIN32
19 #include <pthread.h> 19 #include <pthread.h>
20 #endif 20 #endif
21
22 //#define DEBUG_MUTEX_LOCKER 1
23
24 #include <iostream>
21 25
22 Thread::Thread(Type type, QObject *parent) : 26 Thread::Thread(Type type, QObject *parent) :
23 QThread(parent), 27 QThread(parent),
24 m_type(type) 28 m_type(type)
25 { 29 {
51 } 55 }
52 56
53 #endif 57 #endif
54 } 58 }
55 59
60 MutexLocker::MutexLocker(QMutex *mutex, const char *name) :
61 m_printer(name),
62 m_locker(mutex)
63 {
64 #ifdef DEBUG_MUTEX_LOCKER
65 std::cerr << "... locked mutex " << mutex << std::endl;
66 #endif
67 }
68
69 MutexLocker::~MutexLocker()
70 {
71 }
72
73 MutexLocker::Printer::Printer(const char *name) :
74 m_name(name)
75 {
76 #ifdef DEBUG_MUTEX_LOCKER
77 std::cerr << "MutexLocker: Locking \"" << m_name << "\" in "
78 << (void *)QThread::currentThreadId() << std::endl;
79 #endif
80 }
81
82 MutexLocker::Printer::~Printer()
83 {
84 #ifdef DEBUG_MUTEX_LOCKER
85 std::cerr << "MutexLocker: Unlocking \"" << m_name
86 << "\" in " << (void *)QThread::currentThreadId() << std::endl;
87 #endif
88 }
89