Re: NSImage drawInRect deadlock
Re: NSImage drawInRect deadlock
- Subject: Re: NSImage drawInRect deadlock
- From: Graham Cox <email@hidden>
- Date: Thu, 11 Aug 2016 09:49:19 +1000
> On 9 Aug 2016, at 4:05 AM, Andrew Keller <email@hidden> wrote:
>
> In my app, I’m creating thumbnails of images. To do this in parallel, I’m using the global background dispatch queue:
Just to throw another consideration into the discusion, you don’t say what the thumbnails are being used for.
Typically you might want to display these to the user to browse a collection of images. If that’s the case here, then it might be much more performant to create them only as needed for display, rather than generate a huge batch of them ahead of time. In other words, when an image thumbnail is required *for display*, kick off a thread to fetch it (or display the one you have cached already). This means that first time the user scrolls through the collection, thumbnails will ‘pop in’ to view as each thread completes, but this effect is usually easily tolerated. With scroll pre-fetching you might not even see it at all.
This way your threads are naturally limited by the number of images that are shown at a time, or scrolled newly into view.
—Graham
_______________________________________________
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