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: Gilles Celli <email@hidden>
- Date: Tue, 13 Feb 2007 20:59:37 +0100
Shawn: Your code with the jitter works great, however I really need
to have to acquire
data at the given time (0s and millisec 500). So a NSTimer is not
useful here (which i tried a long time ago...)
The iMac Core 2 Duo is sync'ed via ntp (with a higher poll than
default since we are using internal ntp-server)
and I will get rid of Spotlight, Exposé and Dashboard.
But as Shawn mentionned it's practically impossible on Mac OS X...
maybe a LINUX REAL-TIME can do it ?
Gilles
On Feb 13, 2007, at 8:35 AM, Half Activist wrote:
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