• 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: Communication between Cocoa and Carbon threads
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Communication between Cocoa and Carbon threads


  • Subject: Re: Communication between Cocoa and Carbon threads
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 5 May 2010 11:34:44 -0700

On May 4, 2010, at 10:30 PM, Abhijeet Singh wrote:

> I have read in Mac OSX Technology overview that we can integrate Carbon with Cocoa application. So can anybody suggest what are the possible ways to send message from Cocoa thread to Carbon thread in an Cocoa Application.

There’s really only one kind of thread in an app, although there are multiple APIs (NSThread, pthreads, Carbon’s MP calls). So the question is how to message between threads in general.

If your Carbon code uses runloops already, you can use Mach ports and messages for communication, using CoreFoundation APIs. (I am pretty sure there is Apple sample code demonstrating how to do this.)

If not, you may have to roll your own techniques using classic techniques like a thread-safe queue. Implement the queue with a C or C++ API, and then you can use it from both Carbon and Cocoa code. One thread can then push messages into the queue while another thread runs a loop that pulls messages as they arrive.

—Jens_______________________________________________

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: 
 >Communication between Cocoa and Carbon threads (From: "Abhijeet Singh" <email@hidden>)

  • Prev by Date: Re: [[NSFileManager alloc] init] considered thread-safe
  • Next by Date: Re: Custom NSPathControl
  • Previous by thread: Communication between Cocoa and Carbon threads
  • Next by thread: Weird "iPhone OS 4.0 Library" dialog popping up
  • Index(es):
    • Date
    • Thread