Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another Threading Question



on 6/15/07 8:27 AM, Dave at <email@hidden> wrote:
>>> Is it ok to use malloc() and just pass the buffer back via a Global?
>> 
>> NO. ;-)
> 
> So, what method would you recommend instead?

I'd use ether an MPQueue or a FIFO protected by a POSIX mutex/condition. The
thread just stuffs the pointer into the queue/FIFO and your main plugin
routine checks the queue/FIFO to see if anything is in it; If so it pulls it
out and deletes it when it's done with it.

If you'd like to see the Multiprocessing routines written using the POSIX
API's check out my sample at:

    <http://homepage.mac.com/geowar1/.Public/Sample%20Code/MP2POSIX.zip>

-- 
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)


 _______________________________________________
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

References: 
 >Re: Another Threading Question (From: Dave <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.