• 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: Adding a port to the run loop of a different thread.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding a port to the run loop of a different thread.


  • Subject: Re: Adding a port to the run loop of a different thread.
  • From: Chris Kane <email@hidden>
  • Date: Fri, 23 Nov 2001 20:33:51 -0700

It sounds like the second possibility would be the simpler.

If this is one of your ports, you can put it in a custom-named run loop mode and run the run loop with run...beforeDate:distantPast until it returns NO. Set some global flag before the loop telling your delegate handler to ignore the message, and unset it afterward. If this is the user input event port you want to drain, use AppKit's NSApplication nextEventMatching... with a distantPast timeout date until that returns nil.

Chris Kane
Cocoa Frameworks, Apple

On Wednesday, November 14, 2001, at 07:58 PM, Andre Lipinski wrote:

Hi,

I need to add a port to a run loop of a different thread. I can get an outlet to the run loop easily. Doing this hasn't crashed on me yet, but I'
m expecting it will sooner-or-later.

Is there any safe way to add a port to a run loop in another thread for NSDefaultRunLoopMode?

Or.

Is there a way to flush messages waiting to be received at a port and still be able to use the port afterward?

Thanks,
Andre.
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


  • Follow-Ups:
    • Shadows
      • From: Russ White <email@hidden>
References: 
 >Adding a port to the run loop of a different thread. (From: Andre Lipinski <email@hidden>)

  • Prev by Date: Re: Instance methods VS. Class methods
  • Next by Date: Re: Dynamically creating a class
  • Previous by thread: Adding a port to the run loop of a different thread.
  • Next by thread: Shadows
  • Index(es):
    • Date
    • Thread