• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: MPTask equivalent?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MPTask equivalent?


  • Subject: Re: MPTask equivalent?
  • From: Scott Ribe <email@hidden>
  • Date: Fri, 22 Feb 2008 09:33:03 -0700
  • Thread-topic: MPTask equivalent?

> Is there a way to mix MPTasks in Cocoa? I am really eager to use Cocoa here
> as many things are much easier than in Carbon (less code), but the
> task/multithreading of Cocoa seems weak.

Yes, you can create MPTasks from Cocoa, and use Cocoa from MPTasks. The key
is that there's a whole lot of Cocoa that's not thread-safe, but you can
certainly call performSelectorOnMainThread:withObject:waitUntilDone: from an
MPTask. Object allocation is thread safe, so you can create Objective-C
objects to pass through to that call, and you can create your own
Objective-C classes that are thread-safe.

You can also pass pointers to Objective-C objects through MPQueues. Just
watch out for the race condition of passing an autoreleased object via an
MPQueue--retain the object before putting it on the queue and release it (at
a CORRECT time) after getting it from the queue.

--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 722-0567 voice


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >Re: MPTask equivalent? (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: -outlineView:heightOfRowByItem: gets an item of NULL??
  • Next by Date: Re: [self setLayer:] in initWithFrame:
  • Previous by thread: Re: MPTask equivalent?
  • Next by thread: using C++ class in the Obj-C file (FAILED...)
  • Index(es):
    • Date
    • Thread