Public Member Functions | Private Member Functions | Private Attributes
thread_exception.ThreadWithExc Class Reference

List of all members.

Public Member Functions

def raiseExc

Private Member Functions

def _get_my_tid

Private Attributes

 _thread_id

Detailed Description

A thread class that supports raising exception in the thread from
   another thread.

Definition at line 15 of file thread_exception.py.


Member Function Documentation

determines this (self's) thread id

CAREFUL : this function is executed in the context of the caller
thread, to get the identity of the thread represented by this
instance.

Definition at line 19 of file thread_exception.py.

def thread_exception.ThreadWithExc.raiseExc (   self,
  exctype 
)
Raises the given exception type in the context of this thread.

If the thread is busy in a system call (time.sleep(),
socket.accept(), ...), the exception is simply ignored.

If you are sure that your exception should terminate the thread,
one way to ensure that it works is:

    t = ThreadWithExc( ... )
    ...
    t.raiseExc( SomeException )
    while t.isAlive():
time.sleep( 0.1 )
t.raiseExc( SomeException )

If the exception is to be caught by the thread, you need a way to
check that your thread has caught it.

CAREFUL : this function is executed in the context of the
caller thread, to raise an excpetion in the context of the
thread represented by this instance.

Definition at line 43 of file thread_exception.py.


Member Data Documentation

Definition at line 24 of file thread_exception.py.


The documentation for this class was generated from the following file:


rcommander
Author(s): Hai Nguyen (haidai@gmail.com)
autogenerated on Thu Nov 28 2013 11:46:34