3 ms·
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. W
by maxxxxx 10y ago
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?
- billmalarky 10y agoLike a handler for shutdown events? https://nodejs.org/docs/v0.3.1/api/process.html https://nodejs.org/docs/v0.3.1/api/process.html
- pkaler 10y agoIf 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.