Mercurial > hg > svcore
annotate base/NonRTThread.cpp @ 101:ce1d385f4f89
* Use kill(pid, 0) instead of /proc or sysctl blather for looking up pids
* Add OpenProcess call for Win32
author | Chris Cannam |
---|---|
date | Fri, 05 May 2006 12:34:51 +0000 |
parents | 9a44ccae165c |
children | 173b39ea0728 |
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@96 | 18 #include <pthread.h> |
Chris@96 | 19 |
Chris@96 | 20 NonRTThread::NonRTThread(QObject *parent) : |
Chris@96 | 21 QThread(parent) |
Chris@96 | 22 { |
Chris@96 | 23 setStackSize(512 * 1024); |
Chris@96 | 24 } |
Chris@96 | 25 |
Chris@96 | 26 void |
Chris@96 | 27 NonRTThread::start() |
Chris@96 | 28 { |
Chris@96 | 29 QThread::start(); |
Chris@96 | 30 |
Chris@99 | 31 #ifndef _WIN32 |
Chris@96 | 32 struct sched_param param; |
Chris@96 | 33 ::memset(¶m, 0, sizeof(param)); |
Chris@96 | 34 |
Chris@96 | 35 if (::pthread_setschedparam(pthread_self(), SCHED_OTHER, ¶m)) { |
Chris@96 | 36 ::perror("pthread_setschedparam to SCHED_OTHER failed"); |
Chris@96 | 37 } |
Chris@96 | 38 #endif |
Chris@96 | 39 } |
Chris@96 | 40 |