Re: Asynchronous timers (without a run loop)
Re: Asynchronous timers (without a run loop)
- Subject: Re: Asynchronous timers (without a run loop)
- From: "Påhl Melin" <email@hidden>
- Date: Thu, 4 Dec 2008 14:00:25 +0100
Yes, I could set up a new thread, handling a list of usleep()
intervals between the actual timer events but it would be very hard to
make a reliable, drift-free timer service, handling lots of timer
events and it would take quite some time to develop a fully functional
and reliable version. I really hope I don't have to...
In the Kernel Programming Guide in ADC, chapter 7, Mach Overview, Time
Management, it says:
"The mach_timespec_t API is deprecated in Mac OS X. The newer and
preferred API is based on timer objects
that in turn use AbsoluteTime as the basic data type. AbsoluteTime is
a machine-dependent type, typically
based on the platform-native time base. Routines are provided to
convert AbsoluteTime values to and from
other data types, such as nanoseconds. Timer objects support
asynchronous, drift-free notification, cancellation,
and premature alarms. They are more efficient and permit higher
resolution than clocks."
Does anyone know about this "new API" or any higher level API build on
it? I sounds like a good candidate for my project.
/ Påhl
2008/12/4 Nathan Day <email@hidden>:
> NSRunLoop use to be based on the function select() (it was in GnuStep
> anyway), it waits for inputs but also has a single timeout value also,
> NSRunLoop works out how long the timeout value should be for the shortest
> NSTimer. If you want to wait on multiple timers without using run NSRunLoop
> then you will have to implement this kind of functionality yourself. You can
> then just use sleep() to make your thread wait.
>
> On 04/12/2008, at 9:32 PM, Påhl Melin wrote:
>
>> I need to use timers in a low level library where I need to specify
>> asynchronous callbacks to a timer function. I will not have any run
>> loop so I cannot use NSTimer. Are there any low level timer API to use
>> instead? I haven't found anything useful (yet) on google nor ADC. I
>> assume there must exist some Mach or BSD level API:s that can be used?
>>
>> Any suggestions?
>>
>> / Påhl
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please 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
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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