Leon wrote:
if class A(
use threading,thread module
) to produce 100 thread,how to drop its (100 thread) when its running

As Roggisch suggests, the cleanest way is if the thread kills itself once signaled by an exit condition. However, there is a non-orthodox way of pseudo-forcibly killing threads by catching the kill signal in a traceback. This method is summed up in Connelly Barnes's informal KThread module:
http://www.google.com/groups?q=KThread+group:comp.lang.python&hl=en&lr=&selm=mailman.225.1083634398.25742.python-list%40python.org&rnum=1


Note it won't work in all cases, as it can't kill a thread that's made a blocking system call. However, it may come in useful.
--
http://mail.python.org/mailman/listinfo/python-list
  • ... Leon
    • ... Diez B. Roggisch
      • ... Peter Hansen
    • ... Andrew Koenig
    • ... Michel Claveau - abstraction méta-galactique non triviale en fuite perpétuelle.
    • Chris S.

Reply via email to