I have a Carbon Dynamic Library (built using XCode) that is a plug-
in to another application. Basically it uses QuickTime to grab
frames of a movie and then analyzes each frame and produces a
report at the end.
It works really well, except that it hogs the processor and the
host application is locked out until the end of the movie.
What I would like to be able to do is to Start up a new thread when
I get called and have this process the movie. The host application
would then "poll" via a "Are you done?" API which would return "no"
until the other thread had finished?
How can I go about doing this? What documents should I look at?
What is the recommend API to use? Is there any sample code I could
look at?
http://developer.apple.com/technotes/tn/tn2028.html lists the various
threading APIs, you would probably want to use the MP tasks API. The
document isn't terribly up to date but then nothing much has changed
in that area (from the point of view of the threading models
available). Assuming the processing you are doing is all threadsafe
then I don't see why this wouldn't work.
The MP api provides communication mechanisms (queues, semaphores
etc...) but these days I find the nicest way is to use carbon events
(just be sure you're posting to the event queue for the correct
thread). The HIobjectThreadController (http://developer.apple.com/
samplecode/HIObjectThreadController/ ) sample shows that kind of thing.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden
This email sent to email@hidden