| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Hi Sekhar,
-- John
I'm trying to get a better understanding of issues that may arise when using Objective-C inside of a CoreAudio IOProc.
The CoreAudio Hardware Abstraction Layer calls clients to produce audio on a time-constraint thread. Thus, audio generating functions are discouraged from invoking functions that may block the thread or take "a long time" to return (e.g., locking mutexes, allocating memory, reading from disk) [1].
On the CoreAudio list, it was pointed out that "... ObjC message sends are treated as an opportunity for the ObjC runtime to re- evaluate its world, and thus can not only involve locks, but also memory allocations" [2].
I looked at the source for objc_msgSend <http:// darwinsource.opendarwin.org/10.3/objc4-235/runtime/ Messengers.subproj/objc-msg-ppc.s> and, sure enough, there is a comment before the macro LockCache:
; The collecting cache mechanism precludes the need for a cache lock
; in objc_msgSend. The cost of the collecting cache is small: a few
; K of memory for uncollected caches, and less than 1 ms per collection.
; A large app will only run collection a few times.
I'm assuming this is what was being referred to in the ca-api list post.
Is this comment still accurate? If so, calling objc_msgSend in an IOProc is certainly risking audio glitches. Are there ways to decrease the probability of having the cache collected or is there any way to avoid it altogether? For example, will caching the IMP and invoking that directly help?
Thanks.
- sekhar
_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden
| References: | |
| >Objective-C in a Time Constraint Thread (From: Chandrasekhar Ramakrishnan <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.