• 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
Running a timer on a separate thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Running a timer on a separate thread


  • Subject: Running a timer on a separate thread
  • From: Dave DeLong <email@hidden>
  • Date: Thu, 19 Feb 2009 17:26:40 -0700

Hi everyone,

I'm sure the answer to this is out there, but I having difficulty finding it.

We've got an app that splits off two threads: one to play some background music, and the other to count the beats that have passed so far. We're doing beat counting with a timer (we know the bpm of the music), but we've got a problem:

We split off a thread to have the beat timer (so it doesn't interfere with interface responsiveness), but we can't figure out how to keep the thread alive and open so that the timer can fire. At first, the thread would die right after scheduling the timer on the thread's runloop.

Then we created an NSCondition that doesn't get satisfied until the music has ended, and then had the counting thread -wait on the condition.

Our counting thread is now staying alive, but the timer never fires. Does waiting on the condition lock the thread? If so, how can we keep the thread alive, but still allow the timer to fire on it?

Thanks,

Dave
_______________________________________________

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


  • Follow-Ups:
    • Re: Running a timer on a separate thread
      • From: Ken Thomases <email@hidden>
    • Re: Running a timer on a separate thread
      • From: Shawn Erickson <email@hidden>
  • Prev by Date: Re: Need recommendations for best way to build a custom view
  • Next by Date: Re: Running a timer on a separate thread
  • Previous by thread: Re: How to re-create Finders File Copy
  • Next by thread: Re: Running a timer on a separate thread
  • Index(es):
    • Date
    • Thread