This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to make the loops in two threads run together?  RSS feed

 
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
Sheriff
Posts: 55329
157
  • 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!