如何在 NSTask 退出后不阻塞地通知它的 terminationStatus?
How to be notified of an NSTask's terminationStatus after it exits without blocking?
OS X 部署目标:10.11
给定一个 NSTask, that has an assigned qualityOfService what is the recommended way to be notified when the task exits (i.e. waitUntilExit) 没有阻塞?
一个NSBackgroundActivityScheduler。
- 分配了与 NSTask 相同的服务质量。
- 使用scheduleWithBlock waitUntilExit
- 最后,dispatch_async到主队列并post一个通知。
A dispatch_queue_t,使用 dispatch_get_global_queue。
- 开启NSTask的服务器质量来决定队列的QoS。
- dispatch_async waitUntilExit 块
- 最后,dispatch_async到主队列并post一个通知。
其他方式?
你可以使用 NSTask 的 terminationHandler 属性.
OS X 部署目标:10.11
给定一个 NSTask, that has an assigned qualityOfService what is the recommended way to be notified when the task exits (i.e. waitUntilExit) 没有阻塞?
一个NSBackgroundActivityScheduler。
- 分配了与 NSTask 相同的服务质量。
- 使用scheduleWithBlock waitUntilExit
- 最后,dispatch_async到主队列并post一个通知。
A dispatch_queue_t,使用 dispatch_get_global_queue。
- 开启NSTask的服务器质量来决定队列的QoS。
- dispatch_async waitUntilExit 块
- 最后,dispatch_async到主队列并post一个通知。
其他方式?
你可以使用 NSTask 的 terminationHandler 属性.