• 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: MPTask equivalent?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MPTask equivalent?


  • Subject: Re: MPTask equivalent?
  • From: Ken Thomases <email@hidden>
  • Date: Tue, 11 Mar 2008 00:40:14 -0500


On Mar 10, 2008, at 4:05 PM, Trygve Inda wrote:

I would like to use NSThreads as they seem simpler and Apple's latest docs
discourages MPTasks.


The call I need an equivalent to is MPWaitOnQueue... This blocks a thread
until a message is received OR it times out. Is there a way to get a similar
functionality with NSThread?


Basically I want to do a bit of processing, then wait for say 5 seconds, but
in the interim, I want to be able to send a abort signal to the thread so
that if I need to end the thread it can safely exit asap.

The documentation you're looking for is here:
http://developer.apple.com/documentation/Cocoa/Conceptual/ Multithreading/ThreadSafety/chapter_5_section_1.html


Using an NSConditionLock and its -lockWhenCondition:beforeDate: method may be the most straightforward way to implement what you're trying to achieve. (Note that NSConditionLock is discussed under "Using Locks" in the above documentation, rather than under "Using Conditions".)

-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


References: 
 >Re: MPTask equivalent? (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: Checking "Continuously Updates Value" in NSTextView binding cases Core Data failure
  • Next by Date: Re: NSBundle wierdness in OCUnit target:
  • Previous by thread: Re: MPTask equivalent?
  • Next by thread: NSTokenField bug in 10.5.2?
  • Index(es):
    • Date
    • Thread