• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Threads with connections

 
Peg Jennings
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm currently working on a program with a serial connection inside of a thread.

I'm curious as to if there are any problems with this. As in, will it run smoothly, or will I eventually run into a load of problems?

Has anyone else used serial connections in threads?
 
Paul Clapham
Sheriff
Posts: 21554
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All of your Java code runs in a thread, you don't have any choice in the matter. Many programs have only one thread, but it's still a thread. So your question means you have more than one thread, and you're running this connection thread in Thread A while other stuff is going on in Thread B.

Normally the only time you would have trouble with this sort of setup would be if Thread A and Thread B had to interact with each other. Otherwise, if the two threads just carry on minding their own business, you don't normally have any particular problems.

If you're looking for advice that says "Don't do that", I'm not going to give you that advice.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic