Re: Exiting non-POSIX threads?
Re: Exiting non-POSIX threads?
- Subject: Re: Exiting non-POSIX threads?
- From: Oleg Krupnov <email@hidden>
- Date: Mon, 29 Jul 2013 12:54:26 +0300
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.
On Mon, Jul 29, 2013 at 12:27 PM, Steve Sisak <email@hidden> wrote:
> At 11:34 AM +0300 7/29/13, Oleg Krupnov wrote:
>>
>> However for GCD thread (created with dispatch_async()) I get the
>> following signal:
>>
>> pthread_exit() may only be called against threads created via
>> pthread_create()
>>
>> Is there a way to handle this case?
>
>
> Just return from the block you passed to dispatch_async()
>
>
>> Is there a way to exit a GCD thread?
>
>
> There's no such thing as a "GCD thread" only queues.
>
> (OK, there's a pool of threads that GCD uses to service queues, but you
> don't own them)
>
>
>> At least, is there a way of telling POSIX threads from GCD / other
>> threads?
>
>
> WAYRTTD?
>
> Exiting threads is bad form in general -- if you're really writing an
> exception handler, catch it at the outermost level and just return so the
> thread terminates normally.
>
> Same for your outer block in GCD.
>
> HTH,
>
> -Steve
_______________________________________________
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