0

OS X Deployment Target: 10.11

Given an NSTask, that has an assigned qualityOfService what is the recommended way to be notified when the task exits (i.e. waitUntilExit) without blocking?

  1. A NSBackgroundActivityScheduler.

    • Assigned the same quality of service as that of the NSTask.
    • Use scheduleWithBlock to waitUntilExit
    • Finally, dispatch_async to the main queue and post a notification.
  2. A dispatch_queue_t, using dispatch_get_global_queue.

    • Switch on the quality of server of the NSTask to decide the QoS of the queue.
    • dispatch_async a block to waitUntilExit
    • Finally, dispatch_async to the main queue and post a notification.
  3. Some other way?

qnoid
  • 2,346
  • 2
  • 26
  • 45

1 Answers1

1

You can use NSTask's terminationHandler property.

rocky
  • 3,521
  • 1
  • 23
  • 31