• 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: Ken Thomases <email@hidden>
  • Date: Mon, 29 Jul 2013 09:54:14 -0500

On Jul 29, 2013, at 4:54 AM, Oleg Krupnov wrote:

> Thanks for your answer, Steve, but the problem remains.
>
> In my case, the exception has already been thrown inside the block and
> I cannot catch it or modify it in any way in my handler. I'm basically
> writing an uncaught exception handler. My app should show a crash
> report window and then terminate itself.
>
> The problem is that if the exception happens in another thread, the
> app gets instantly terminated by the system after my exception handler
> (unlike exceptions in the main thread that are automatically
> absorbed), unless I terminate the crashed thread manually. [NSThread
> exit] worked with NSThreads, but with GCD threads (starting from
> start_wqthread), it's causing the signal.

Look into the ExceptionHandling framework and/or the NSSetUncaughtExceptionHandler() function.
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Exceptions/Tasks/ControllingAppResponse.html#//apple_ref/doc/uid/20000473-BBCHGJIJ

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.

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.

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

Regards,
Ken


_______________________________________________

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: Oleg Krupnov <email@hidden>
    • Re: Exiting non-POSIX threads?
      • From: Kevin Meaney <email@hidden>
References: 
 >Exiting non-POSIX threads? (From: Oleg Krupnov <email@hidden>)
 >Re: Exiting non-POSIX threads? (From: Oleg Krupnov <email@hidden>)

  • Prev by Date: Re: Exiting non-POSIX threads?
  • Next by Date: Re: Screen capture on OS X
  • Previous by thread: Re: Exiting non-POSIX threads?
  • Next by thread: Re: Exiting non-POSIX threads?
  • Index(es):
    • Date
    • Thread