• Post Reply Bookmark Topic Watch Topic
  • New Topic

Will this ever lockup?

 
Andre Mermegas
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

[This message has been edited by Andre Mermegas (edited July 26, 2001).]
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, strictly speaking, there are no guarantees about the effect of setPriority() on a thread. It is theoretically possible that threadTwo could start method2() before threadOne starts method1(). If this were to happen, of course method1() could not start until method2() had fully completed, and once method1 entered the wait there would be no method2() to send the notify(), so threadOne would wait forever. But in practice, I'd bet large amounts of money that no JVM implementation from any respectable vendor would ever allow threadTwo to run ahead of threadOne, given the utter difference in their priorities and the fact that threadOne.start() is called before threadTwo. It's not strictly guaranteed by the JLS, but it's pretty much guaranteed by common sense about how to implement thread priorities. IMO anyway.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!