• 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: Asynchronous timers (without a run loop)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Asynchronous timers (without a run loop) (From: "Påhl Melin" <email@hidden>)
 >Re: Asynchronous timers (without a run loop) (From: Nathan Day <email@hidden>)
 >Re: Asynchronous timers (without a run loop) (From: "Påhl Melin" <email@hidden>)
 >Re: Asynchronous timers (without a run loop) (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Asynchronous timers (without a run loop) (From: "Påhl Melin" <email@hidden>)
 >Re: Asynchronous timers (without a run loop) (From: Joseph Kelly <email@hidden>)
 >Re: Asynchronous timers (without a run loop) (From: "Påhl Melin" <email@hidden>)
 >Re: Asynchronous timers (without a run loop) (From: "Julien Jalon" <email@hidden>)
 >Re: Asynchronous timers (without a run loop) (From: "Påhl Melin" <email@hidden>)
 >Re: Asynchronous timers (without a run loop) (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: Asynchronous timers (without a run loop)
  • Next by Date: Re: Asynchronous timers (without a run loop)
  • Previous by thread: Re: Asynchronous timers (without a run loop)
  • Next by thread: Re: Asynchronous timers (without a run loop)
  • Index(es):
    • Date
    • Thread