S
shoe
hi all!
If a method is synchronized like this:
public synchronized void broadcast (String message) {
I have like 10 threads calling the broadcast method.
What happens to all threads calling this method?
Does the threads halt/wait and line up in a qeueue??
Is it like when one use the Wait-notify system or what.
Does the threads stop what they are doing when they
try to get access to the synchronized method and the method
is locked.
I know that when I use the wait() it will put
thread's in the Wait mode. I can then do a notify/all
and the waiting threds will continue. This is easy to
understand. But the synchronized is not like that I guess
Hope you understand what I mean!
If a method is synchronized like this:
public synchronized void broadcast (String message) {
I have like 10 threads calling the broadcast method.
What happens to all threads calling this method?
Does the threads halt/wait and line up in a qeueue??
Is it like when one use the Wait-notify system or what.
Does the threads stop what they are doing when they
try to get access to the synchronized method and the method
is locked.
I know that when I use the wait() it will put
thread's in the Wait mode. I can then do a notify/all
and the waiting threds will continue. This is easy to
understand. But the synchronized is not like that I guess
Hope you understand what I mean!