'determines this (self\'s) thread id'

def _get_my_tid(self):

    if (not self.isAlive()):
        raise threading.ThreadError('the    thread    is    not    active')
    if hasattr(self, '_thread_id'):
        return self._thread_id
    for (tid, tobj) in threading._active.items():
        if (tobj is self):
            self._thread_id = tid
            return tid
    raise AssertionError("could    not    determine    the    thread's    id")
