views:

174

answers:

1

The software im currently working on sometimes hangs when I close the serial port. Its intermittent and works fine 90% of the time but I clearly have an issue. When I ctl+Alt+Break it shows that its waiting on serial.Close().

I have lots a data coming in and out on the serial port which is being invoked to a number of forms so is this a threading issue?

+2  A: 

Yes, this may be the case. See this post. See also here, which suggests that using BeginInvoke rather than Invoke may solve your problem.

Also, if you're using a USB serial adapator, you could have a driver problem. Some of those drivers are poorly written and can cause a whole host of problems.

Jon B
BeginInvoke on all of my module GUI code was going to be too scary so i used the other tip from the link you posted.I spawn another thread which closes the port!
Tim