armadsen / ORSSerialPort

Serial port library for Objective-C and Swift macOS apps
MIT License
751 stars 183 forks source link

Make it so -[ORSSerialPort dealloc] also closes the port if needed #141

Open armadsen opened 5 years ago

armadsen commented 5 years ago

This is currently difficult because closing a port is an asynchronous operation, and therefore can't be triggered by the time the object is being deallocated. One possible fix is to create a helper object that is responsible for actually closing the port, whose lifetime is independent of the ORSSerialPort instance, and that can keep itself alive until the port is actually closed.