> On Mar 22, 2020, at 6:20 PM, Steve Mills via Cocoa-dev 
> <cocoa-dev@lists.apple.com> wrote:
> 
> 
>> 
>> On Mar 22, 2020, at 15:38, Rob Petrovec via Cocoa-dev 
>> <cocoa-dev@lists.apple.com> wrote:
>> 
>> I would not do this.  It is widely documented that AppKit API that produce 
>> UI elements, like NSOpenPanel, are _not_ thread safe.
> 
> The code shown *is* threadsafe. It’s calling it on the main thread.
The only issue I see is that if this code were ever called on the main thread.  
I don’t know if this is likely because we don’t know enough about the OP’s 
code.  But if there is a chance a simple test would suffice.

if ( [NSThread isMainThread] )
   // call code directly
else
   // call dispatch_sync(…)

Sandor

> 
> Steve via iPad
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com
> 
> This email sent to admin.szatmari....@gmail.com
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to