Re: OTMP Question
Re: OTMP Question
- Subject: Re: OTMP Question
- From: Quinn <email@hidden>
- Date: Mon, 20 Jan 2003 16:09:50 +0000
At 14:58 -0500 13/1/03, Mal Paine wrote:
This could easily be solved _if_ OTMP provided a function like
OTMPXUnprepareTask(MPTaskID inTask). Then, from my application thread, I
could just call OTMPXUnprepareTask(task) followed by MPTerminateTask(task,
reason).
But since OTMP doesn't provide this function, how can I correctly call
OTMPXUnprepareThisTask before task termination given that the application
thread can terminate the OTMP tasks at any time?
Terminating an MP task from another task (ie using MPTerminateTask)
is almost always a bad idea. Typically the terminated task owns some
resources (allocated memory, open endpoints, etc), and if you call
MPTerminateTask then the task never has a chance to deallocate them.
As a rule, MPTerminateTask is only useful for terminating "compute
only" tasks, things like Photoshop filters, that never allocate any
resources. For networking, you have to be more careful.
A better solution is to force the task to terminate itself. In the
case of OTMP, you typically do this by calling
OTMPCancelSynchronousCalls on the task's working endpoint. If the
task is blocked on the endpoint, it will unblock with an error. At
that point the task gets to terminate itself cleanly.
S+E
--
Quinn "The Eskimo!" <
http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.