• 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: silly event question 'cuz i'm a n00b
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: silly event question 'cuz i'm a n00b


  • Subject: Re: silly event question 'cuz i'm a n00b
  • From: Chris Idou <email@hidden>
  • Date: Wed, 8 Oct 2008 20:37:48 -0700 (PDT)

If all you actually want is a flag, why not just have a flag? When the other thread gets around to examining the flag, it can do what it wants.

If you need to synchronize access to the flag, because say, the number of times they press the button is significant, then put an @synchronized directive around methods that access the flag, and make it a count or something.

You can put messages on the other threads' RunLoop (Read the doco on RunLoops), but that may be harder than it needs to be.

The other option is your worker thread calls  performSelectorOnMainThread:withObject:waitUntilDone to access a flag or count maintained by the gui. Because you access it from a method executed from the main thread, there would be no synchronization issues.


--- On Wed, 10/8/08, John Zorko <email@hidden> wrote:

> From: John Zorko <email@hidden>
> Subject: silly event question 'cuz i'm a n00b
> To: email@hidden
> Date: Wednesday, October 8, 2008, 7:46 PM
> Hello, all ...
>
> If a certain flag is set, my app needs to advance to the
> next item in
> a list to process it when the previous item is done.
> However, I want
> the user to still be able to stop it, so I don't want
> to hang the UI.
> In effect, if this flag is set, I want the app to act as if
> the user
> had manually selected the next item to process.
>
> In Win32, one way I could do this is by using PostMessage()
> -- when
> the current item is finished processing, it would post a
> message to
> the relevant threads' message queue and it would get
> processed, just
> as if the message was put there as a result of a GUI
> action.  How do I
> do this in Cocoa, or is there a better way?
>
> Regards,
>
> John
>
> Falling You - exploring the beauty of voice and sound
> http://www.fallingyou.com
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
>
> 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



_______________________________________________

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: 
 >silly event question 'cuz i'm a n00b (From: John Zorko <email@hidden>)

  • Prev by Date: re: refreshObject doesn't seem to work
  • Next by Date: Re: refreshObject doesn't seem to work
  • Previous by thread: Re: silly event question 'cuz i'm a n00b
  • Next by thread: Mirror...rorriM
  • Index(es):
    • Date
    • Thread