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: Fri, 5 Dec 2008 15:18:02 +0100
2008/12/5 Jean-Daniel Dupas <email@hidden>:
> The dotnet timer is useless for a lots of cases for one reason: "The method
> does not execute on the thread that created the timer"
> It uses a theadpool setup by the framework in background.
In my case, I have no need at all, to run the callback from any
particular thread. The callback function is handling a shared resource
and is thus reentrant and uses a mutex lock to protect the resource. A
quite common case – but of course, sometimes it's nice not caring
about synchronization.
> I really prefere the OS X approach that let you do something similar in 5
> lines of code, but is more flexible, as it also allow you to execute timer
> on a predefined thread.
A matter of taste – for both approaches. Sometimes one a approach is
better than the other and sometimes vice versa.
> Now, you can request a wrapper API that create it's own thread, and call a
> callback function on a random thread when it triggers, but I doubt they will
> include it in Cocoa.
I doubt it too...
/ 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