5

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
  • 271
  • 3
  • 11

1 Answers1

2

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
  • 62,604
  • 14
  • 116
  • 151
  • 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