[java] Blocking IO
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
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement