code: def run(self, *args):
          
          if self.running:
              return self
  
          self._mut_finished(False)  # in case of recovery from a disaster.
          self._mut_running(True)
  
          stream = self.target(*args)
  
          # noinspection SpellCheckingInspection
          def subr():
              self._mut_running(True)
              try:
                  for each in stream:
                      self._product = each
                      desc = self.descriptor_mapping(each)
                      event = self.events.get(desc)
                      if event:
                          event(self, each, globals)
                  self._mut_finished(True)
              except ThreadExit:
                  pass
              finally:
                  self._mut_running(False)
  
          self._thread = thread = threading.Thread(target=subr, args=())
          thread.start()
          return self
docs: You can choose whether to use lock method when running threads.