Re:Thread priorities
Re:Thread priorities
- Subject: Re:Thread priorities
- From: email@hidden
- Date: Mon, 23 Jul 2001 20:48:55 +0300
Try the following (in the thread which is supposed to run in background):
#include <pthread.h>
//declarations of PTHREAD variables
pthread_t tid;
int ret;
struct sched_param param;
int lowPriority, policy;
lowPriority = 0;
tid = pthread_self();
ret = pthread_getschedparam(tid, &policy, ¶m);
policy = SCHED_OTHER;
param.sched_priority = lowPriority;
ret = pthread_setschedparam(tid, policy, ¶m);
Note that in pthreads 0 is for low priority. I think 127 is the highest
priority.
Andrei
I know that this is not strictly Cocoa, but I have a thread that I wish
to
run in the background at a lower priority. How do I adjust the thread
priority and/or where is this documented?
Thanks.
Michael Christian
Thomson multimedia Inc.