> On Mar 22, 2020, at 6:20 PM, Steve Mills via Cocoa-dev 
> <[email protected]> wrote:
> 
> 
>> 
>> On Mar 22, 2020, at 15:38, Rob Petrovec via Cocoa-dev 
>> <[email protected]> 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 ([email protected])
> 
> 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 [email protected]
_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to