ADC Home > Reference Library > Technical Q&As > Carbon > Runtime Architecture >

How do I use kMPCreateTaskSuspendedMask with MPCreateTask?


Q: When I call the MPCreateTask API with the kMPCreateTaskSuspendedMask option my task is suspended at startup but I then can't figure out how to resume it. Is there an API that can resume my task?

A: The kMPCreateTaskSuspendedMask was originally intended to allow debuggers to start tasks in the suspended state. But because of how exception handlers work the ability to resume a task that wasn't suspended by an actual exception was never possible. If you want to suspend a task when it starts and be able to resume it later you have to use the MPThrowException API in your task at the point where you want to suspend it. You exception handler can then resume that task at a later time. Optionally, if all you want is to be able stop/start the task you may consider using one of the synchronization / signaling API's (semaphores, queue, event groups, critical regions, etc.).


[Jul 02 2001]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.