AUGraph manipulation deadlock
AUGraph manipulation deadlock
- Subject: AUGraph manipulation deadlock
- From: patrick machielse <email@hidden>
- Date: Wed, 06 Jul 2011 15:13:06 +0200
I have a Cocoa app hosting an AUGraph. I'm running into a deadlock when I'm trying to manipulate the graph from the main thread when at the same time the graph is accessed from the render thread. Sample is attached.
In short:
** MAIN THREAD **
9305 AudioUnitGraph::Stop()
9305 AudioOutputUnitStop
9305 CallComponentDispatch
9305 DefaultOutputAUEntry
9305 AUGenericOutputEntry
9305 AUGenericOutputEntry
9305 AudioDeviceStop
9305 HALDevice::StopIOProc(long (*)(unsigned long, AudioTimeStamp const*, AudioBufferList const*, AudioTimeStamp const*, AudioBufferList*, AudioTimeStamp const*, void*))
9305 HALPlugIn::DeviceStopIOProc(HALObject const&, long (*)(unsigned long, AudioTimeStamp const*, AudioBufferList const*, AudioTimeStamp const*, AudioBufferList*, AudioTimeStamp const*, void*))
9305 HP_HardwarePlugIn_DeviceStop(AudioHardwarePlugInInterface**, unsigned long, long (*)(unsigned long, AudioTimeStamp const*, AudioBufferList const*, AudioTimeStamp const*, AudioBufferList*, AudioTimeStamp const*, void*))
9305 HP_Device::ExecuteCommand(HP_Command*)
9305 IOA_Device::StartCommandExecution(void**)
9305 CAMutex::Lock()
9305 pthread_mutex_lock
9305 semaphore_wait_signal_trap
** RENDER THREAD **
9305 HP_IOProc::Call(AudioTimeStamp const&, AudioTimeStamp const&, AudioBufferList const*, AudioTimeStamp const&, AudioBufferList*)
9305 AUGenericOutputEntry
9305 0x70005b86
9305 renderCallback
9305 AUGraphGetIndNode
9305 CAMutex::Lock()
9305 pthread_mutex_lock
9305 semaphore_wait_signal_trap
renderCallback() is called on a render notification (kAudioUnitRenderAction_PreRender).
The documentation on AUGraph says:
"A graph object’s state can be manipulated in both the rendering thread and in other threads. Consequently, any activities that affect the state of the graph are guarded with locks and a messaging model between any calling thread and the thread upon which the graph object’s output unit is called (the render thread)."
I took this to mean that proper locking is handled for me by the AUGraph functions. Do I need to provide locking around all AUGraph functions myself?
Thanks,
patrick
--
Patrick Machielse
Hieper Software
http://www.hieper.nl
email@hidden
Analysis of sampling ********* (pid 1754) every 1 millisecond
Call graph:
9305 Thread_20536 DispatchQueue_1: com.apple.main-thread (serial)
9305 start
9305 main
9305 NSApplicationMain
9305 -[NSApplication run]
9305 -[NSApplication sendEvent:]
9305 -[NSWindow sendEvent:]
9305 -[NSControl mouseDown:]
9305 -[NSSliderCell trackMouse:inRect:ofView:untilMouseUp:]
9305 -[NSCell trackMouse:inRect:ofView:untilMouseUp:]
9305 -[NSCell _sendActionFrom:]
9305 -[NSControl sendAction:to:]
9305 -[_NSBindingAdaptor objectDidTriggerAction:]
9305 -[_NSBindingAdaptor _objectDidTriggerAction:bindingAdaptor:]
9305 -[NSValueBinder performAction:]
9305 -[NSValueBinder applyDisplayedValueHandleErrors:typeOfAlert:canRecoverFromErrors:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:]
9305 -[NSValueBinder _applyObjectValue:forBinding:canRecoverFromErrors:handleErrors:typeOfAlert:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:]
9305 -[NSBinder setValue:forBinding:error:]
9305 -[NSBinder _setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error:]
9305 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:]
9305 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:]
9305 -[NSManagedObject setValue:forKey:]
9305 -[NSManagedObject(_PFDynamicAccessorsAndPropertySupport) _setGenericValue:forKey:withIndex:flags:]
9305 _sharedIMPL_setvfk_core
9305 _PF_ManagedObject_DidChangeValueForKeyIndex
9305 -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:]
9305 NSKeyValueDidChange
9305 NSKeyValueNotifyObserver
9305 -[*********ProcessorFileInfo observeValueForKeyPath:ofObject:change:context:]
9305 _NSSetDoubleValueAndNotify
9305 -[*********AudioProcessor setPlaybackTime:]
9305 -[*********AudioProcessor rebuildPlaybackGraph]
9305 -[*********AudioProcessor stopPlayback]
9305 AudioUnitGraph::Stop()
9305 AudioOutputUnitStop
9305 CallComponentDispatch
9305 DefaultOutputAUEntry
9305 AUGenericOutputEntry
9305 AUGenericOutputEntry
9305 AudioDeviceStop
9305 HALDevice::StopIOProc(long (*)(unsigned long, AudioTimeStamp const*, AudioBufferList const*, AudioTimeStamp const*, AudioBufferList*, AudioTimeStamp const*, void*))
9305 HALPlugIn::DeviceStopIOProc(HALObject const&, long (*)(unsigned long, AudioTimeStamp const*, AudioBufferList const*, AudioTimeStamp const*, AudioBufferList*, AudioTimeStamp const*, void*))
9305 HP_HardwarePlugIn_DeviceStop(AudioHardwarePlugInInterface**, unsigned long, long (*)(unsigned long, AudioTimeStamp const*, AudioBufferList const*, AudioTimeStamp const*, AudioBufferList*, AudioTimeStamp const*, void*))
9305 HP_Device::ExecuteCommand(HP_Command*)
9305 IOA_Device::StartCommandExecution(void**)
9305 CAMutex::Lock()
9305 pthread_mutex_lock
9305 semaphore_wait_signal_trap
9305 Thread_20553 DispatchQueue_2: com.apple.libdispatch-manager (serial)
9305 start_wqthread
9305 _pthread_wqthread
9305 _dispatch_worker_thread2
9305 _dispatch_queue_invoke
9305 _dispatch_mgr_invoke
9305 kevent
9305 Thread_20714
9305 thread_start
9305 _pthread_start
9305 CAPThread::Entry(CAPThread*)
9305 HP_IOThread::ThreadEntry(HP_IOThread*)
9305 HP_IOThread::WorkLoop()
9305 HP_IOThread::PerformIO(AudioTimeStamp const&, double)
9305 IOA_Device::CallIOProcs(AudioTimeStamp const&, AudioTimeStamp const&, AudioTimeStamp const&)
9305 HP_IOProc::Call(AudioTimeStamp const&, AudioTimeStamp const&, AudioBufferList const*, AudioTimeStamp const&, AudioBufferList*)
9305 AUGenericOutputEntry
9305 0x70005b86
9305 renderCallback
9305 AUGraphGetIndNode
9305 CAMutex::Lock()
9305 pthread_mutex_lock
9305 semaphore_wait_signal_trap
Total number in stack (recursive counted multiple, when >=5):
Sort by top of stack, same collapsed (when >= 5):
semaphore_wait_signal_trap 18610
kevent 9305
_______________________________________________
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