code: def scan_threads(self):
          
  
          # Ignore special process IDs.
          # PID 0: System Idle Process. Also has a special meaning to the
          #        toolhelp APIs (current process).
          # PID 4: System Integrity Group. See this forum post for more info:
          #        http://tinyurl.com/ycza8jo
          #        (points to social.technet.microsoft.com)
          #        Only on XP and above
          # PID 8: System (?) only in Windows 2000 and below AFAIK.
          #        It's probably the same as PID 4 in XP and above.
          dwProcessId = self.get_pid()
          if dwProcessId in (0, 4, 8):
              return
  
  ##        dead_tids   = set( self.get_thread_ids() ) # XXX triggers a scan
          dead_tids   = self._get_thread_ids()
          dwProcessId = self.get_pid()
          hSnapshot   = win32.CreateToolhelp32Snapshot(win32.TH32CS_SNAPTHREAD,
                                                                   dwProcessId)
          try:
              te = win32.Thread32First(hSnapshot)
              while te is not None:
                  if te.th32OwnerProcessID == dwProcessId:
                      dwThreadId = te.th32ThreadID
                      if dwThreadId in dead_tids:
                          dead_tids.remove(dwThreadId)
  ##                    if not self.has_thread(dwThreadId): # XXX triggers a scan
                      if not self._has_thread_id(dwThreadId):
                          aThread = Thread(dwThreadId, process = self)
                          self._add_thread(aThread)
                  te = win32.Thread32Next(hSnapshot)
          finally:
              win32.CloseHandle(hSnapshot)
          for tid in dead_tids:
              self._del_thread(tid)
docs: Populates the snapshot with running threads.