Re: MPTask equivalent?
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