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