Skip navigation.
 
mlRe: MPTask equivalent?
FROM : j o a r
DATE : Wed Feb 20 20:22:48 2008

On Feb 20, 2008, at 8:03 PM, Trygve Inda wrote:

> I am moving a rendering engine of sorts from Carbon to Cocoa. It is 
> heavily
> based on MPTasks and uses Carbon events to send messages back to the 
> main
> event handler (on the main thread) to handle things that are not 
> thread
> safe.
>
> In Carbon, I would Post an event and call:
>
> err = MPWaitOnQueue (pTaskInfo->mSignalQueueID, (void **)
> &pTaskInfo->mQueueMessage, NULL, NULL, kDurationForever);
> if (pTaskInfo->mQueueMessage == kMyTaskSignalAbort)
> pTaskInfo->mAbort = true;
>
> When the main thread would be done with the task, it would call:
>
> MPNotifyQueue (pTaskInfo->mSignalQueueID, (void *) 
> kMyTaskSignalContinue,
> NULL, NULL);
>
> Is there a good online reference to the Cocoa equivalent of this?
>
> Any pointers as to how I should structure this in Cocoa?



You could probably use:

   -[NSObject performSelectorOnMainThread:withObject:waitUntilDone:];


> How much of Cocoa is thread safe?



Very little, and the documentation on that topic is somewhat lacking.

j o a r

Related mailsAuthorDate
mlMPTask equivalent? Trygve Inda Feb 20, 20:03
mlRe: MPTask equivalent? j o a r Feb 20, 20:22
mlRe: MPTask equivalent? Charles Steinman Feb 20, 21:09
mlRe: MPTask equivalent? Adam P Jenkins Feb 20, 22:32
mlRe: MPTask equivalent? Trygve Inda Feb 21, 16:10
mlRe: MPTask equivalent? Trygve Inda Feb 21, 16:14
mlRe: MPTask equivalent? j o a r Feb 21, 16:20
mlRe: MPTask equivalent? Scott Ribe Feb 22, 17:33
mlRe: MPTask equivalent? Trygve Inda Mar 10, 22:05
mlRe: MPTask equivalent? Hamish Allan Mar 10, 22:41
mlRe: MPTask equivalent? Ken Thomases Mar 11, 06:40