4

Possible Duplicate:
Is there any way to kill a Thread in Python?

As we know pthread library supports pthread_kill() to kill a peer thread, but I'm just wondering why doesn't python support this feature? Any answer is helpful, thanks,:)

Community
  • 1
  • 1
nrek
  • 261
  • 3
  • 11

1 Answers1

3

Killing threads isn't really very useful. Indeed, it usually causes trouble.

Killing a thread generall causes (at least) some of the following problems:

  • Memory leak
  • Other resource leak (file descriptors, etc)
  • Deadlock (due to lock which is never unlocked by the killed thread)

Which are undesirable.

Don't do it.

MarkR
  • 61,128
  • 14
  • 112
  • 147
  • 1
    Just to add a bit of clarification to this answer... Kill the thread by asking it to stop itself, as opposed to immediately terminating it by the parent thread. – jdi Jun 28 '12 at 16:22