Re: Thread count strangeness using PlayAudioFile sample code
Re: Thread count strangeness using PlayAudioFile sample code
- Subject: Re: Thread count strangeness using PlayAudioFile sample code
- From: Robert Martin <email@hidden>
- Date: Tue, 29 Mar 2005 13:15:35 -0500
If it just left one thread hanging about I could understand - but each time I call to play a file, the count goes up. So at the end of session, you might have more than 100 threads hanging around! - they never get re-used when the app calls again. It just doesn't sound right!
I create the AU component only once, the first time through, and re-use it on subsequent calls after resetting it, so I can't understand why it's always creating a new thread that is never released - I use exactly the same clean up as the sample code.
I suppose the sample code might have left a step out, since it is built as a one-shot. I've tried UnInitializing() and re-Initializing() the AU component, but that makes no difference.
Rob
On Mar 29, 2005, at 10:26 AM, Shawn Erickson wrote:
On Mar 29, 2005, at 6:29 AM, Robert Martin wrote:
It works fine, but I ran top and noticed that after each call to PlayAudioFile, my thread count permanently increases by 1. I'm new to threads and cannot figure out what's causing this - or even whether I should worry about it.
Likely nothing to worry about at all. Use shark (part of the CHUD tools from Apple) or thread viewer to see if that thread is doing anything when not using audio units, etc. I bet it would simple block waiting for work.
Can anyone point me in a direction to understand what's going on?
I bet the thread is created lazily and will stay around waiting for work while your application continues to run. This is likely done to avoid thread creation overhead if you are starting and stopping unit often, etc.
Similar things happen with the GUI heartbeat thread used by AppKit for animation effects.
-Shawn
_______________________________________________
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