Re: Communication between Cocoa and Carbon threads

Christiaan Hofman <[email protected]> Wed, 5 May 2010 10:47:45 +0200
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On May 5, 2010, at 7:29, Abhijeet Singh wrote:

> Hi,I am new to Cocoa. Me and my team are working on an application for a scientific instrument. It is a Cocoa application in that user interface part is being developed using Cocoa. Now we have some lower level code that interacts with hardware and they are basically Carbon threads. Now our user interface needs to communicate with these Carbon threads. 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. At present I am looking into NSThread details to find a way of communication....Thanks & Regards AbhijeetDear macosxdev ! Get Yourself a cool, short @in.com Email ID now!

First of all, this is too broad a question to answer in any meaningful way. There are lots of ways to handle multi-threading, even if you would restrict yourself to Cocoa or Carbon or C. What you do specifically may depend on what you want to do and what you have. 

Really the only meaningful thing I can say is that you can simply use Carbon inside Cocoa, due to the fact that Cocoa is an extension of C (and Carbon is a C), and because of toll free bridging, and moreover you can use Cocoa in Carbon for the same reason. Also, both Carbon and Cocoa use run loops, and both the Carbon and Cocoa run loops are based on CFRunLoop, so you probably want to look into that API.

Christiaan