• 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: Concurrent loading of images?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Concurrent loading of images?


  • Subject: Re: Concurrent loading of images?
  • From: João Varela via Cocoa-dev <email@hidden>
  • Date: Fri, 8 May 2020 22:41:07 +0100

> I also read about the GCD's dispatch queues, but it seems to me that this
would not be the suitable approach since I always only have one task
running concurrently to the main thread.

>
> Why not? Dispatch queues are always available. (The main thread is simply
> a special queue.) You can run the background task by creating a single
> dispatch queue and then using dispatch_async to call a block that does the
> work. The end of the block would call dispatch_async back to the main queue
> and pass the image as a parameter.


I could not agree more with Jens. Great Central Dispatch has been a big
boon. Before GCD, I would not touch multithreaded code with a ten-foot
pole. Now I use it everyday and I can increase responsiveness as never
before. I would definitely take a look at it. You can load images with a
background thread and then when the loading is done you can dispatch it to
the main queue for display. It has never been so easy to do that.

João


>
>
_______________________________________________

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

  • Prev by Date: Re: Concurrent loading of images ?
  • Next by Date: Re: Concurrent loading of images ?
  • Previous by thread: Re: Concurrent loading of images ?
  • Next by thread: Finding memory leaks
  • Index(es):
    • Date
    • Thread