Re: atexit and kAudioDevicePropertyDeviceIsRunning problem
Re: atexit and kAudioDevicePropertyDeviceIsRunning problem
- Subject: Re: atexit and kAudioDevicePropertyDeviceIsRunning problem
- From: Jeff Moore <email@hidden>
- Date: Fri, 28 Apr 2006 11:33:43 -0700
On Apr 27, 2006, at 11:17 PM, email@hidden wrote:
Jeff Moore writes:
kAudioDevicePropertyDeviceIsRunning has never indicated whether
or not the HAL is calling IOProcs. It is there to say whether or
not the IO thread itself is running in the process. It is a
common and legal case that the IO thread is running even though
no IOProcs are being called.
Reading through the documentation again I already feared that this
might be the case. Is it possible to check, IF the IO thread is
still calling the IOProcs?
No.
Finally, I'd be a bit worried about using an atexit handler for
this job. The reason why is that the HAL is also using an atexit
handler to clean itself up. This means that the order of
execution of your handler and the HAL's is going to depend on the
order in which the handlers are registered.
The problem here is that libao is just a library. Adplay for
example uses this library and also cleans everything up in an
atexit call when shutting down. Other programs like uade work fine
since the do not use atexit. The problem is that people using the
library might use atexit or not and they want libao to behave like
on every other platform.
The HAL is just a library too.
If one is using atexit(), one has to be cognizant that a lot of
services are going to be in an indeterminate state.
If there is no other way I'll just shutdown everything without
waiting for the buffers to be emptied. Since HAL is also stopping
the ioprocs is it a problem if this is done twice? First by me and
then by the HAL or the other way around.
As long as you are prepared for possibly getting errors from the HAL
since the HAL may have already unloaded itself by the time you get to
run.
IMHO, you should look at doing as little as possible in your atexit
handler. Unless you are dealing with resource that won't get cleaned
up automagically as part of the process teardown, I don't see any
reason to do anything in your atexit handler. Files will get closed.
Remote mach ports will get the client death notification. Memory will
be freed. Connections to drivers will get closed.
--
Jeff Moore
Core Audio
Apple
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden