• 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
Killing a stuck NSThread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Killing a stuck NSThread


  • Subject: Killing a stuck NSThread
  • From: Dustin Wenz <email@hidden>
  • Date: Wed, 26 Apr 2006 13:56:37 -0500

I have an application that spawns an NSThread to perform a blocking network operation. Sometimes the operation takes too long to execute and needs to be cancelled or killed by the main thread.

There was a discussion earlier this month about doing something similar to this with NSThreads. The solution then was to send a signal to the thread to have it terminate gracefully. Unfortunately, since my thread is busy waiting for something, it has no way of receiving such a signal.

I've tried obtaining a pthread id from the NSThread and doing a pthread_kill() on it. For some reason though, calling pthread_self() in the child thread actually gets the id for the main thread, so I have no way to find the id for the child in order to kill it. Are there any other solutions for this?

	- .Dustin

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Killing a stuck NSThread
      • From: Tom Marchand <email@hidden>
    • Re: Killing a stuck NSThread
      • From: Axel Andersson <email@hidden>
  • Prev by Date: Re: how do I put ints in for NSUserDefaults for keys?
  • Next by Date: catches in @catches (was: NSError: why returned directly?)
  • Previous by thread: Re: NSString init
  • Next by thread: Re: Killing a stuck NSThread
  • Index(es):
    • Date
    • Thread