• 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: NSOperation Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOperation Question


  • Subject: Re: NSOperation Question
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 7 Jan 2009 19:42:15 -0600

On Jan 7, 2009, at 6:45 PM, Sandro Noel wrote:

How would I go about having an operation stay alive as long as my application is alive,

If this is what you want, then it's no longer an operation, it's just a thread. Don't use NSOperation for this.



I use DiskAppearedCallback / DiskDisappearedCallback from the DiskArbitration Framework
in my application and I want the to be in their separate thread.

Why do you want them to be in a separate thread? The run loop is designed specifically to allow for monitoring of various input sources without the need to spawn threads.



How can i have the thread not quit as soon as the callback's are registered?

If you really want to use a thread, add a dummy NSPort to the thread's run loop and then just run the run loop. The thread will just sit in the run loop and process DiskArbitration callbacks when they happen.


Cheers,
Ken

_______________________________________________

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: NSOperation Question
      • From: Sandro Noel <email@hidden>
References: 
 >NSOperation Question (From: Sandro Noel <email@hidden>)

  • Prev by Date: Re: NSOperation Question
  • Next by Date: Re: Returning value from detached NSThread selector with multiple arguments.
  • Previous by thread: Re: NSOperation Question
  • Next by thread: Re: NSOperation Question
  • Index(es):
    • Date
    • Thread