• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re:Thread priorities
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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, &param);
policy = SCHED_OTHER;
param.sched_priority = lowPriority;
ret = pthread_setschedparam(tid, policy, &param);


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.


  • Follow-Ups:
    • Re: Thread priorities
      • From: Georg Tuparev <email@hidden>
  • Prev by Date: Re: Thread priorities
  • Next by Date: Re: Use of NSLog() for debugging
  • Previous by thread: Re: Thread priorities
  • Next by thread: Re: Thread priorities
  • Index(es):
    • Date
    • Thread