• 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: while loop with sleep(): logging works, but not UI events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: while loop with sleep(): logging works, but not UI events


  • Subject: Re: while loop with sleep(): logging works, but not UI events
  • From: "Stephen J. Butler" <email@hidden>
  • Date: Fri, 27 Jun 2008 23:01:57 -0500

On Fri, Jun 27, 2008 at 10:55 PM, Daniel Richman
<email@hidden> wrote:
> What's happening is that if I enter a number and then press 'start', 'start'
> stays in the 'pressed' position until the loop finishes, after which it
> returns to the normal position. My guess is that this is stopping any other
> UI events from occurring. This would also explain why I'm able to log a
> message each time the loop iterates.
>
> But I'm still not sure why the button is staying pressed. Thoughts, anyone?

If you're not running the event loop then the button has no chance to
repaint. You absolutely cannot block the main thread like this and
expect the GUI to still function.

Any reason you're not using NSTimer? Along with the painting issues,
this strategy also won't work 100% of the time because sleep() is only
guaranteed to block for *at most* a certain number of seconds. It can
exit early if it chooses to, in particular it will if you don't mask
signals from being delivered on your thread,
_______________________________________________

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: 
 >while loop with sleep(): logging works, but not UI events (From: Daniel Richman <email@hidden>)

  • Prev by Date: NSPopupButton Bindings-Related Issue
  • Next by Date: Re: Why aren't my bindings firing?
  • Previous by thread: Re: while loop with sleep(): logging works, but not UI events
  • Next by thread: Re: while loop with sleep(): logging works, but not UI events
  • Index(es):
    • Date
    • Thread