genielabs / serialport-lib-dotnet

Serial Port libray for .Net / Mono
https://www.nuget.org/packages/SerialPortLib/
Apache License 2.0
157 stars 65 forks source link

Added IsBackground = true | Fixing a hung process #26

Closed Hiprox closed 1 year ago

Hiprox commented 1 year ago

Fixed an issue where a parent thread was closed from which the _connectionWatcherand _reader child threads were started, and the child thread continued its work, resulting in a suspended state of one or more threads after the main form of the application UI was closed. . . The problem became obvious in WinForms dot-net 7.0 when I created and configured several SerialPortInputobjects on a child form, called Connectmethod for all of them, and then called Disconnectfor all of them and closed first the child form and then the main form and the process remained hanging in Task Manager.

genemars commented 1 year ago

Thank you for this pull request, I was also facing a similar issue with automation programs in HomeGenie. Using IsBackground=true will fix that as well.