Mercurial > hg > svcore
comparison base/NonRTThread.cpp @ 96:1aebdc68ec6d
* Introduce simple non-RT thread base class
* Rename MatrixFileCache to MatrixFile
* some fixes & tidying
author | Chris Cannam |
---|---|
date | Thu, 04 May 2006 16:03:02 +0000 |
parents | |
children | 9a44ccae165c |
comparison
equal
deleted
inserted
replaced
95:040a151d0897 | 96:1aebdc68ec6d |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Sonic Visualiser | |
5 An audio file viewer and annotation editor. | |
6 Centre for Digital Music, Queen Mary, University of London. | |
7 This file copyright 2006 Chris Cannam. | |
8 | |
9 This program is free software; you can redistribute it and/or | |
10 modify it under the terms of the GNU General Public License as | |
11 published by the Free Software Foundation; either version 2 of the | |
12 License, or (at your option) any later version. See the file | |
13 COPYING included with this distribution for more information. | |
14 */ | |
15 | |
16 #include "NonRTThread.h" | |
17 | |
18 #include <pthread.h> | |
19 | |
20 NonRTThread::NonRTThread(QObject *parent) : | |
21 QThread(parent) | |
22 { | |
23 setStackSize(512 * 1024); | |
24 } | |
25 | |
26 void | |
27 NonRTThread::start() | |
28 { | |
29 QThread::start(); | |
30 | |
31 #ifndef Q_WS_WIN32 | |
32 struct sched_param param; | |
33 ::memset(¶m, 0, sizeof(param)); | |
34 | |
35 if (::pthread_setschedparam(pthread_self(), SCHED_OTHER, ¶m)) { | |
36 ::perror("pthread_setschedparam to SCHED_OTHER failed"); | |
37 } | |
38 #endif | |
39 } | |
40 |