Re: Sound Manager & MIDI callbacks, interrupts and threads
Re: Sound Manager & MIDI callbacks, interrupts and threads
- Subject: Re: Sound Manager & MIDI callbacks, interrupts and threads
- From: Kurt Bigler <email@hidden>
- Date: Tue, 19 Feb 2002 22:14:38 -0800
Herbie, I emailed my reply to you directly, but meant to reply to the list.
So I am now posting our exchange to the list, since I figure it might be
generally useful.
Thanks,
Kurt Bigler
on 2/18/02 4:37 PM, Herbie Robinson wrote (to the list):
>
>> If you have a fixed number of buffers you are dealing with (fairly
>
>> likely), you might be able to structure the queue as a circular
>
>> buffer. If you can do that, you don't have to lock. Just remember
>
>> to use "volatile" on the buffer indexes so the compiler doesn't
>
>> optimize things too much. The less locking you do, the better; so,
>
>> if you can use a circular buffer, it's a win.
Kurt Bigler replied (off-list, by mistake):
>
> I remember reading that "volatile" is a "hint" to the compiler, so that
>
> dependng on the implementation the compiler is free to ignore it. This
>
> never gave me that warm fuzzy feeling about my multi-threaded
>
> circular-buffer implementations that depend on "volatile".
>
>
>
> Do we in fact know how CodeWarrior and ProjectBuilder treat "volatile"?
Herbie Robinson <email@hidden> replied (off-list):
>
I checked the CW documentation and it claims to support volatile.
>
>
I think GCC does. I couldn't find any direct statement about it
>
working, but it does state that the -traditional option disables the
>
keyword. I also found "When you use setjmp and longjmp, the only
>
automatic variables guaranteed to remain valid are those declared
>
volatile." and "Accesses to bitfields even in volatile objects works
>
by accessing larger objects, such as a byte or a word. You cannot
>
rely on what size of object is accessed in order to read or write the
>
bitfield; it may even vary for a given bitfield according to the
>
precise usage". Also, it would be really hard to write device driver
>
and OS code without the volatile attribute and GCC is used all over
>
the place for that.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.