On May 14, 2012, at 5:34 AM, McLaughlin, Michael P. wrote: > This past weekend I tried compiling my Snow Leopard Cocoa app in Lion (Xcode > 4.3) just to make sure all was OK. I got two warnings stating that > MPProcessorsScheduled and MPCreateCriticalRegion were deprecated in Lion but > the relevant Lion docs did not say what they should to be replaced with. > > I use MPProcessorsScheduled to create an equal number of parallel threads > (for a long computation) and MPCreateCriticalRegion to serialize the core of > a pseudo-random-number generator. > > Two questions: > > 1. What should I replace these with? > 2. Will that replacement also work in Snow Leopard and, if not, what > if-criterion should I use to make the code work in both places? > > Thanks very much for any help.
Read up on Grand Central Dispatch. It can manage pretty much all of the hard work of parallelizing code, including replacing synchronization primitives like Mutexes and CriticalRegions (just access those sections on a single GCD queue with dispatch_sync, and you're guaranteed synchronous access). -- Glenn L. Austin, Computer Wizard and Race Car Driver <>< "Where there's breath, there's hope!" <http://www.austin-soft.com> _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com