[java] Blocking IO

Started by
0 comments, last by Glass_Knife 17 years ago
To stop the Input from blocking the loop, i put it in its own thread where it informs the user when data has arrived that way then they can grab it. Is this okay ? Or will I see random problems in this design
Advertisement
Quote:Original post by bgilb
To stop the Input from blocking the loop, i put it in its own thread where it informs the user when data has arrived that way then they can grab it. Is this okay ? Or will I see random problems in this design


The problem with using threads in java is that many people do not understand how to correctly write multi-threaded code. Random problems could be problems with two threads sharing the same resorce. Are you having random problems, or are you wondering about the design?

If you have a long task that is blocking the user interface, there may be nothing wrong with just using the SwingWorker class. But that all depends on what you are doing?

Read through this tutorial and see if you have any more questions.

I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming

My Twitter: https://twitter.com/indieprogram

My Book: http://amzn.com/1305076532

This topic is closed to new replies.

Advertisement