Re: How to set scheduling in NSThread based application
Re: How to set scheduling in NSThread based application
- Subject: Re: How to set scheduling in NSThread based application
- From: Half Activist <email@hidden>
- Date: Tue, 13 Feb 2007 08:35:39 +0100
Hi Gilles,
I think Shawn Erickson is right, if you've got to wait for 500ms at
each loop,
you should actually wait for (500ms-timePollingTook) to be more
precise.
It doesn't ensure that your thread will wake up every 500ms,
- because nanosleep isn't that accurate and computing the time needed
to sleep itself takes some time
- nanosleep can return EINTR if it's been interrupted by a signal,
so you should wait a little more time if it woke up too early.
- you can't (almost) run a time critical operation on a time sharing
system, the problem of accuracy getting bigger with system load
Realtime capabilities of Mac OS X may come to your help,but I don't
really know,
I might be totally wrong.
Regards
PS: maybe you could give a look at pthread_cond_timedwait
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden