• 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: Exiting non-POSIX threads?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exiting non-POSIX threads?


  • Subject: Re: Exiting non-POSIX threads?
  • From: Oleg Krupnov <email@hidden>
  • Date: Tue, 30 Jul 2013 12:13:38 +0300

Thanks Ken,

> However, you're not supposed to let exceptions escape from blocks which you submit to dispatch queues.  That's documented in the link I gave in my previous reply.

Yes, thanks for pointing it out, but let me note that this is not
consistent with other parts of the AppKit. When an exception happens
in the main thread, it is logged to the console and quietly absorbed
without any additional action on my part.

Now if the exception happens in a non-main thread, I am obliged to
catch it or otherwise the app will be instantly terminated. This is
inconsistent. I may not be using or even expecting any exceptions in
the thread, but merely use some NSAssert's and want to report logical
errors in my code. Putting explicit @try/@catch in every thread with
NSAssert's seems like an overkill or even something I should not rely
upon, because I want to write a catch-all for problems, including my
own bugs, such as forgetting to wrap the thread in @try/@catch.

> If you exit a thread that you don't own, you may screw up your app's ability to present a dialog.  Perhaps AppKit relies on that thread.  Perhaps the thread held a crucial resource and other threads will deadlock when they try to access it.

I'd disagree. This thread has already crashed and its exception was
not caught, and so the thread is about to be terminated with or
without my intervention. Killing it myself would hardly produce any
side effects. I just want to prevent the entire app from termination
and so far it seems darn impossible.

> All in all, what you're doing seems like a bad idea.

Maybe but what is the right solution to this?
_______________________________________________

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: Exiting non-POSIX threads?
      • From: Ken Thomases <email@hidden>
    • Re: Exiting non-POSIX threads?
      • From: Kyle Sluder <email@hidden>
    • Re: Exiting non-POSIX threads?
      • From: Scott Ribe <email@hidden>
References: 
 >Exiting non-POSIX threads? (From: Oleg Krupnov <email@hidden>)
 >Re: Exiting non-POSIX threads? (From: Oleg Krupnov <email@hidden>)
 >Re: Exiting non-POSIX threads? (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Mixing Obj-C and C "methods"
  • Next by Date: Re: Exiting non-POSIX threads?
  • Previous by thread: Re: Exiting non-POSIX threads?
  • Next by thread: Re: Exiting non-POSIX threads?
  • Index(es):
    • Date
    • Thread