• 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: NSImage drawInRect deadlock
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage drawInRect deadlock


  • Subject: Re: NSImage drawInRect deadlock
  • From: Andrew Keller <email@hidden>
  • Date: Tue, 09 Aug 2016 23:47:17 -0400

Am 09.08.2016 um 7:38 nachm. schrieb Andrew Keller <email@hidden>:
> Am 09.08.2016 um 3:59 nachm. schrieb Kyle Sluder <email@hidden>:
>> On Tue, Aug 9, 2016, at 07:38 AM, Andrew Keller wrote:
>>
>>> I was under the impression from the docs that macOS
>>> handles the thread pool “automatically”.
>>
>> Mike Ash did a good job explaining why this isn’t as “automatic” as one
>> might think:
>> https://www.mikeash.com/pyblog/friday-qa-2009-09-25-gcd-practicum.html <https://www.mikeash.com/pyblog/friday-qa-2009-09-25-gcd-practicum.html>
>
> Wow.  That was incredibly eye opening.  I’m seeing the exact same symptoms he’s describing — the deadlock is just the sugar on top.
>
> I’m going to play with some of his concepts and see what happens.  I wonder if the deadlock can be worked around by using the image scaling approach he uses in his example.

A few interesting observations:

1. Mike’s thumbnail generation process is vulnerable to the same deadlock as my code.  In hindsight, this is not surprising since we are both using drawInRect.
2. When utilizing Mike’s approach to limiting the number of parallel tasks down to, say, 1-8, I have been completely unable to reproduce the deadlock.
3. When utilizing Mike’s approach to limiting the number of parallel tasks, Xcode is still saying that threads a being created like crazy — almost one thread per block submitted to the queue.

#2 suggests that this deadlock issue is related to very large (20+?  30+?  40+?  100+?) numbers of threads operating at the same time.

Not sure what to do about #3.  So long as it doesn’t negatively impact the app, I suppose I could ignore it for now.  (Unless anyone has seen this behavior, and perhaps foresees a problem with it.)

Thanks,
 - Andrew


_______________________________________________

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


  • Follow-Ups:
    • Re: NSImage drawInRect deadlock
      • From: Quincey Morris <email@hidden>
References: 
 >NSImage drawInRect deadlock (From: Andrew Keller <email@hidden>)
 >Re: NSImage drawInRect deadlock (From: Aaron Tuller <email@hidden>)
 >Re: NSImage drawInRect deadlock (From: Jens Alfke <email@hidden>)
 >Re: NSImage drawInRect deadlock (From: Aaron Tuller <email@hidden>)
 >Re: NSImage drawInRect deadlock (From: Jens Alfke <email@hidden>)
 >Re: NSImage drawInRect deadlock (From: Kyle Sluder <email@hidden>)
 >Re: NSImage drawInRect deadlock (From: Andrew Keller <email@hidden>)
 >Re: NSImage drawInRect deadlock (From: Kyle Sluder <email@hidden>)
 >Re: NSImage drawInRect deadlock (From: Andrew Keller <email@hidden>)

  • Prev by Date: Automatically sizing a UIPopoverController
  • Next by Date: Re: NSImage drawInRect deadlock
  • Previous by thread: Re: NSImage drawInRect deadlock
  • Next by thread: Re: NSImage drawInRect deadlock
  • Index(es):
    • Date
    • Thread