0

I have a Player.java class and a Driver.java class. I need to set up communication between threads. I have them set up in an array and I am able to access the attributes from each in my main(). However, I need to use synchronization with my program and am not sure how to access my threads (created in Driver) in my Player class.

How can I access these threads outside of the main() method in order to manipulate them in my run() method?

4

2 回答 2

0

假设您使用的是 Java 7,请查看TransferQueue

于 2013-07-12T00:33:55.920 回答
0

for threads communication, you need to create some shared data, and synchronize them. then use wait/notify mechanism to interact between threads.

于 2013-07-12T08:23:40.180 回答