Re: Pausing an NSThread
Re: Pausing an NSThread
- Subject: Re: Pausing an NSThread
- From: Greg Guerin <email@hidden>
- Date: Sat, 7 Nov 2009 22:34:39 -0700
Ron Fleckner wrote:
I've finally worked out a way to pause a thread and would like to
know if what I'm doing is dangerous or bad or...?
Exactly what problem are you trying to solve?
Pausing a thread is always potentially dangerous. Any locks or
@synchronized blocks acquired before reaching the pause-point will
still be held by the paused thread. That means any other threads
waiting for those locks will continue waiting. And if one of those
threads happens to be involved with other locks related to whoever
initiated the pause, then you have deadlock.
It's precisely this potential deadlock that caused Java's suspend()
method to be deprecated some time ago.
http://java.sun.com/j2se/1.4.2/docs/guide/misc/
threadPrimitiveDeprecation.html
Please read that, then explain what problem you're trying to solve by
pausing a thread, or using a lock.
I assume it has something to do with your comment "// Do some stuff
with strings from the array and send the strings to a text view on
the main window", but without the full explanation, it means
nothing. It's about as meaningful as saying "I can call spirits from
the vasty deep", without giving the incantation, what you will bid
them do, or whether they will come when you do call for them.
-- GG
_______________________________________________
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