Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why isnt my wait() and waitFor() working? please help




On Mar 16, 2006, at 12:42 PM, Shou ryuujo wrote:

I tried using thread.wait(), this.wait() p.wait() etc. but i get errors saying they are not owner of the thread. I am not sure why the program terminates before waitFor() and goes through if waitFor () isnt there.. please help!


For this part anyhow - to avoid the 'not owner' errors.
synchronized(thread) {
try {
thread.wait();
}
catch (InterruptedException iex) { iex.printStackTrace(); }
}
or
synchronzied(this) {
try {
this.wait();
}
catch (InterruptedException iex) { iex.printStackTrace(); } }
or
the same for p, synchronized(p) { wait stuff and so on }, if you want to wait on it you need to own the object lock and synchronized is what acquires it.



Mike Hall mikehall at spacestar dot net http://www.spacestar.net/users/mikehall http://sourceforge.net/projects/macnative



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >why isnt my wait() and waitFor() working? please help (From: Shou ryuujo <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.