• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Deadlock in AUHAL?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Deadlock in AUHAL?


  • Subject: Deadlock in AUHAL?
  • From: Joakim Nyström <email@hidden>
  • Date: Mon, 30 May 2005 19:10:54 +0200

Hi

I've got a deadlock in what seems to be AUHAL code. The deadlock can be reproduced with a rather simple program. However it's seems like it is dependent on the timing (The deadlock appears when running from Xcode but not when running directly from the Finder / Terminal.)

Basically my application outputs a sine to the default output (in my case a Terratec Phase 24 FW) using the following code:
(I'm including this code to give you a hint of what I'm doing.)


<x-tad-smaller>int</x-tad-smaller><x-tad-smaller> main (</x-tad-smaller><x-tad-smaller>int</x-tad-smaller><x-tad-smaller> argc, </x-tad-smaller><x-tad-smaller>char</x-tad-smaller><x-tad-smaller> * </x-tad-smaller><x-tad-smaller>const</x-tad-smaller><x-tad-smaller> argv[])
{
CAUHAL myAUHAL;
myAUHAL.SetRenderFunction(&Sine);

myAUHAL.SetSampleRate(</x-tad-smaller><x-tad-smaller>192000</x-tad-smaller><x-tad-smaller>);
myAUHAL.SetBufferSize(</x-tad-smaller><x-tad-smaller>2400</x-tad-smaller><x-tad-smaller>);
myAUHAL.SetStreamFormat();

myAUHAL.Start();

sleep(</x-tad-smaller><x-tad-smaller>5</x-tad-smaller><x-tad-smaller>);

myAUHAL.SetBufferSize(</x-tad-smaller><x-tad-smaller>512</x-tad-smaller><x-tad-smaller>);
myAUHAL.SetSampleRate(</x-tad-smaller><x-tad-smaller>32000</x-tad-smaller><x-tad-smaller>);
myAUHAL.SetBufferSize(</x-tad-smaller><x-tad-smaller>2400</x-tad-smaller><x-tad-smaller>);

sleep(</x-tad-smaller><x-tad-smaller>5</x-tad-smaller><x-tad-smaller>);

myAUHAL.Stop();



</x-tad-smaller><x-tad-smaller>return</x-tad-smaller><x-tad-smaller> </x-tad-smaller><x-tad-smaller>0</x-tad-smaller><x-tad-smaller>;
}
</x-tad-smaller>

Sampling of the application (with "Activity Monitor") gives the following results:
<x-tad-smaller>Analysis of sampling pid 16297 every 10.000000 milliseconds
Call graph:
290 Thread_110b
290 _dyld_start
290 _start
290 main
290 CAUHAL::SetBufferSize(unsigned long)
290 AudioUnitSetProperty
290 CallComponent
290 0x990c74e0
290 DefaultOutputAUEntry
290 DefaultOutputAUEntry
290 DefaultOutputAUEntry
290 AUHALEntry
290 AudioDeviceSetProperty
290 HALPlugInDevice::SetPropertyData(HALPropertyAddress const&, unsigned long, void const*, AudioTimeStamp const*)
290 HPPlugInDeviceSetProperty(AudioHardwarePlugInInterface**, unsigned long, AudioTimeStamp const*, unsigned long, unsigned char, unsigned long, unsigned long, void const*)
290 IOAPlugIn::DeviceSetProperty(unsigned long, AudioTimeStamp const*, unsigned long, unsigned char, unsigned long, unsigned long, void const*)
290 IOADevice::SetPropertyData(HPPropertyAddress const&, unsigned long, void const*, AudioTimeStamp const*)
290 HPDevice::SetPropertyData(HPPropertyAddress const&, unsigned long, void const*, AudioTimeStamp const*)
290 HPPropertyObject::SetPropertyData(HPPropertyAddress const&, unsigned long, void const*, AudioTimeStamp const*)
290 HPIOBufferSizeProperty::SetData(HPPropertyAddress const&, unsigned long, void const*, AudioTimeStamp const*)
290 HPDevice::ExecuteCommand(HPCommand*)
290 IOADevice::SetIOBufferFrameSize(unsigned long)
290 HPDevice::PropertyChanged(HPPropertyAddress const&) const
290 AudioHardwareDevicePropertyChanged
290 HALPropertyObject::PropertyChanged(HALPropertyAddress const&)
290 HALPropertyObject::CallListeners(HALPropertyAddress const&) const
290 AUHALEntry
290 DefaultOutputAUEntry
290 pthread_mutex_lock
290 semaphore_wait_signal_trap
290 semaphore_wait_signal_trap
290 Thread_1203
290 _pthread_body
290 CAPThread::Entry(CAPThread*)
290 HALRunLoop::OwnThread(void*)
290 CFRunLoopRunSpecific
290 __CFRunLoopRun
290 __CFRunLoopDoSource1
290 __CFMachPortPerform
290 IOADevice::EngineMachPortCallBack(__CFMachPort*, void*, long, void*)
290 IOADevice::AudioEngineFormatChanged(unsigned int)
290 HPFormatList::BroadcastFormatChangedNotifications(HPStream*, AudioStreamBasicDescription const&, bool, AudioStreamBasicDescription const&, bool, bool)
290 HPDevice::PropertyChanged(HPPropertyAddress const&) const
290 AudioHardwareDevicePropertyChanged
290 HALPropertyObject::PropertyChanged(HALPropertyAddress const&)
290 HALPropertyObject::CallListeners(HALPropertyAddress const&) const
290 AUHALEntry
290 DefaultOutputAUEntry
290 DefaultOutputAUEntry
290 DefaultOutputAUEntry
290 DefaultOutputAUEntry
290 AudioDeviceSetProperty
290 HALPlugInDevice::SetPropertyData(HALPropertyAddress const&, unsigned long, void const*, AudioTimeStamp const*)
290 HPPlugInDeviceSetProperty(AudioHardwarePlugInInterface**, unsigned long, AudioTimeStamp const*, unsigned long, unsigned char, unsigned long, unsigned long, void const*)
290 IOAPlugIn::DeviceSetProperty(unsigned long, AudioTimeStamp const*, unsigned long, unsigned char, unsigned long, unsigned long, void const*)
290 CAGuard::Lock()
290 pthread_mutex_lock
290 semaphore_wait_signal_trap
290 semaphore_wait_signal_trap

Total number in stack (recursive counted multiple, when >=5):
8 DefaultOutputAUEntry

Sort by top of stack, same collapsed (when >= 5):
semaphore_wait_signal_trap 580
Sample analysis of process 16297 written to file /dev/stdout
Sampling process 16297 each 10 msecs 300 times
</x-tad-smaller>


I've already filed a bug to Apple (Problem ID: 4133953) regarding this but I want to know if anyone else has experienced this or similar problems. In that case, is there any good workarounds?

Thanks


/ Joakim Nyström


--
Joakim Nyström
Developer
Propellerhead Software
 _______________________________________________
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

  • Follow-Ups:
    • Re: Deadlock in AUHAL?
      • From: Doug Wyatt <email@hidden>
  • Prev by Date: Crash in TDeinterleaver with mono sound
  • Next by Date: Re: audio output
  • Previous by thread: Re: Crash in TDeinterleaver with mono sound
  • Next by thread: Re: Deadlock in AUHAL?
  • Index(es):
    • Date
    • Thread