Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How do people handle shutdown of applications while async/await stuff is still executing? I do a lot of desktop app and need to stop executing when it closes. With the async stuff it's really hard to tell what's still in the queue to be executed and should be waited for.

Is the whole pattern more for server stuff where you can assume there will be no shutdowns?



If you're on OSX/iOS you would use an NSOperation and NSOperationQueue.

Your NSOperation objects would conform to the NSCoding protocol. Then you would iterate through NSOperationQueue.operations and use NSKeyedArchiver to serialize.


Like a handler for shutdown events?

https://nodejs.org/docs/v0.3.1/api/process.html




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: