On Jul 22, 2016, at 19:29 , Graham Cox <graham....@bigpond.com> wrote:
> 
> If the worker thread is waiting for -performOnMainThread to complete, it 
> *cannot* possibly get a call from the main thread to terminate

I nodded agreement when I first read this, then “but wait!” …

Your logic seems flawed on two counts:

1. The selector performed by the worker thread may still be queued, so the main 
thread is doing something else which may result in an attempt to terminate the 
worker thread.

2. The worker method performed on the main thread may directly or indirectly 
lead to an attempt to terminate the worker thread.

Both scenarios could cause a deadlock. At least, that’s my attempt at logic.

The real problem is that it’s simply a bug to have two threads with mutual, 
synchronous, unconditional waits. Of course that’s going to deadlock eventually.

_______________________________________________

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