File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Threads and Synchronization and the fly likes send message from thread to other Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "send message from thread to other" Watch "send message from thread to other" New topic

send message from thread to other

Mohamad Samy
Ranch Hand

Joined: Apr 26, 2013
Posts: 98
I have the following code to check the winner of the TicTacToe game, when any condition within is satisfied (for example here is first condition at line 8 ) I could send the current player a message with his result either he won or lost but I can't give the result of the game to the other player as I am in the current player thread, how could I do this.
I tried to switch to the other player through
but that don't work either
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

None of that code should be sending any messages to the other player. The caller of that method is the one who should be sending such a message, if the method returns true. Pseudocode:

I agree. Here's the link:
subject: send message from thread to other
It's not a secret anymore!