Threads: Infinite Loops + Synchronized Methods
With the following Runnable:
publicvoid run{
while(true){
// something
}
}
publicsynchronized method ......{}
Synchronized methods lock the object until the method returns correct?
Would that method never be callable then because run() never returns
and therefore it cant get a lock?
Ive never tried the above code. I usually do the following:
publicvoid run{
while(true){
synchronized(object){
}
// something
}
}
public method ......{
synchronized(object){}
}
And synchronize on an object.
I was just curious if im right about the first case.

