What are the OSX equivalent of replacing Cocoa or the carbon equivalent of legacy multiprocessor services?

So I am working on updating a large project from really old C ++ / Carbon code and I keep using deprecated features.

So, I think there are two aspects to this question.

Immediate question:

What should you use instead of the following functions, which are deprecated in 10.7? Are there Cocoa carbon equivalents or updated carbon equivalents?

MPCreateEvent MPDeleteEvent MPWaitForEvent MPSetEvent

And the second part of the question: is there a place on the Apple developer site or elsewhere that I can find more information on what to use in cases where the old code is officially out of date?


source to share

1 answer

First of all, you should read the Concurrency Programming Guide . There are several ways to achieve concurrency in Cocoa applications, and this guide explains them all in detail.

Probably the closest analogue of Carbon functions is the various Grand Central Dispath (GCD) functions, which allow code to run in the background by passing in an Objective-C block:

dispatch_queue_t aQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(aQueue, ^{
    NSLog(@"Do some work in the background here.");


All of this is detailed in the concurrency docs. Unfortunately, I was unable to find any documentation on the deprecation of the multiprocessing API. That said, this API is very old since Mac OS X, and I suspect Apple assumes that most of the code is in use for a long time. I do not envy you your challenge!

Note that GCD and blocks were introduced in 10.6. If for some reason you need to support 10.5, you can use the methods NSOperation

that were introduced in this version of the OS. They are not as easy to use as GCD, but they can achieve a similar result. NSOperation

is still available and very good for certain use cases.



All Articles