• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to make the loops in two threads run together?

 
angel Pena
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys, im making a bomberman that works with sockets. have two threads, and both have loops. One is the game, and one is the client part of the game that sends and receive information form the server. i need that when an iteration in the client part is over (it already read and send all it needed to) it waits for the iteration on the game loop to end. then they should start at the same time and so on.

Im a real newbie with threads, and i dont know if this is even possible. is there a way of doing this? thank you beforehand.
 
Campbell Ritchie
Marshal
Posts: 52555
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

What do you know about wait and notify? Would fork and join help? You can find them both in the Java™ Tutorials.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!