• 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: AVFoundation and the main thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AVFoundation and the main thread


  • Subject: Re: AVFoundation and the main thread
  • From: Jens Alfke <email@hidden>
  • Date: Tue, 20 Dec 2016 09:09:46 -0800

I’ll also argue that if you’re needing to do this kind of thing from a background thread, your code isn’t factored properly.

Managing the UI of the app is far too complex a task to try to coordinate among multiple threads. The current best practices for concurrent programming suggest that you should try to minimize the amount of (mutable) state shared between threads, and instead have the threads interact mostly by messaging.

So in this specific case, if a background thread does something that requires a player view to be resized, it should send a message (or post a block) to the main thread and let the main thread do it. (And hopefully the background thread isn’t concerning itself with pixels, but instead with something like the length of a track or the number of tracks, which the main thread’s UI logic can then translate into pixel dimensions.)

—Jens
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >AVFoundation and the main thread (From: Andreas Falkenhahn <email@hidden>)
 >Re: AVFoundation and the main thread (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: AVFoundation and the main thread
  • Next by Date: Symbolic breakpoints or category?
  • Previous by thread: Re: AVFoundation and the main thread
  • Next by thread: Re: AVFoundation and the main thread
  • Index(es):
    • Date
    • Thread