• 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: To thread or not to thread?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: To thread or not to thread?


  • Subject: Re: To thread or not to thread?
  • From: Dado Colussi <email@hidden>
  • Date: Mon, 30 Jan 2006 11:05:16 +0200

Jeremy Hubbell wrote:
I have a simple function that randomly generates color values that I'd like to execute when a checkbox is enabled and terminates when the checkbox is unchecked. I tried a while loop using [sender state == 1]


Not to thread.

How about using an NSTimer to fire randomly? Set the first expiration time randomly and the interval to some long time. When the timer expires, it calls your handler function that does the color thing if the checkbox is checked and otherwise does nothing. Then readjust the next expiration time to a random time in the future at the end of your timer handler function.

Good luck!

Dado
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: To thread or not to thread?
      • From: Andrew Thompson <email@hidden>
References: 
 >To thread or not to thread? (From: Jeremy Hubbell <email@hidden>)

  • Prev by Date: Re: NSTextField background
  • Next by Date: Re: Core Data: updating a key dependent on a to-many relationship?
  • Previous by thread: To thread or not to thread?
  • Next by thread: Re: To thread or not to thread?
  • Index(es):
    • Date
    • Thread