• 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
Re: Suspend/resume change the IO thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suspend/resume change the IO thread


  • Subject: Re: Suspend/resume change the IO thread
  • From: "Paul Sanders" <email@hidden>
  • Date: Thu, 27 May 2010 15:45:43 +0100

> We need to call some code *once* in the IO thread (to setup up a pthread_key_t thread local stuff...). Until now we were using a second IO callback to be added and started (AudioDeviceAddIOProc and AudioDeviceStart) and that was just removing itself (AudioDeviceStop..;) after being called.
 
I'm a bit puzzled as to why you need thread local storage in the IO thread.  It sounds like life would be simpler if you could do away with this.

> We have just seen that the IO thread identifier (the one got with pthread_self()) is changed when the machine is suspended/resumed.  So our init code is not properly called anymore when the IO thread resume. Is there any cleaner and more reliable way to call some code once in the IO thread and properly handle the suspend/resume case? (like some notification to be listened to) ?

I may be missing something here, but if you are using thread-local data the destructor passed to pthread_key_create should tell you when the IO thread terminates (I guess you might need an 'I am the IO thread' flag in your thread-specific data block).  And when the new thread starts up (if it ever does), pthread_getspecific will return NULL so you can start over.  This also applies the first time through, of course.

Paul Sanders.
 
 _______________________________________________
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

References: 
 >Suspend/resume change the IO thread (From: Stéphane Letz <email@hidden>)
 >Re: Suspend/resume change the IO thread (From: Jeff Moore <email@hidden>)

  • Prev by Date: Re: Audio Queue Help
  • Next by Date: Remote IO render callback
  • Previous by thread: Re: Suspend/resume change the IO thread
  • Next by thread: kIOAudioControlUsagePassThru equivalent on the iPhone
  • Index(es):
    • Date
    • Thread