java: communication between threads
- by TRU7H
I'm making a little java game in which I would have two threads (well as the FIRST step towards multithreading...), one for the logic and one for the drawing.
So my question is: How can I make those two communicating which each other?
Requirements:
accessing variables and object from a another thread
syncing them so they each complete a same number of "loops" in the same time.
(the logic calculates and then the another one draws the results and the loop begins again...)
So how is this achievable in java?
Thanks in advance!