![]() |
|
#1
|
|||
|
|||
Java threads trouble (wait() and notify())I have a main program, which starts two separate threads Sender and Receiver. Those threads extend Thread, and they contain the following:
main (Server.java) JAVA Code:
JAVA Code:
JAVA Code:
JAVA Code:
Thanks, Bill |
|
#2
|
||||
|
||||
Re: Java threads trouble (wait() and notify())Can you possibly share more source of what you're trying to do? It is not clear if "DO STUFF" might be sharing any functionality.
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#3
|
||||
|
||||
Re: Java threads trouble (wait() and notify())I found a reference that says notify() [and notifyAll() for a ThreadGroup] can only be used within synchronized code. That why I am curious about "DO STUFF".
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#4
|
||||
|
||||
Re: Java threads trouble (wait() and notify())Never mind your source. I came up with this for an example:
JAVA Code:
... and here's the console output... Starting threads... Threads started! RECEIVER: process info... SENDER: send info. to receiver RECEIVER: process info... SENDER: send info. to receiver RECEIVER: process info... SENDER: send info. to receiver RECEIVER: process info... SENDER: send info. to receiver ... __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
Recent GIDBlog
Python ebook by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The