class_docstr: A Thread for running a zmq Authenticator
  
  This is run in the background by ThreadedAuthenticator
class_docstr_tok: ["A","Thread","for","running","a","zmq","Authenticator","This","is","run","in","the","background","by","ThreadedAuthenticator"]
docstr: Start the Authentication Agent thread task
docstr_tok: ["Start","the","Authentication","Agent","thread","task"]
code: def run(self):
      """Start the Authentication Agent thread task"""
      self.authenticator.start()
      self.started.set()
      zap = self.authenticator.zap_socket
      poller = zmq.Poller()
      poller.register(self.pipe, zmq.POLLIN)
      poller.register(zap, zmq.POLLIN)
      while True:
          try:
              socks = dict(poller.poll())
          except zmq.ZMQError:
              break  # interrupted
  
          if self.pipe in socks and socks[self.pipe] == zmq.POLLIN:
              # Make sure all API requests are processed before
              # looking at the ZAP socket.
              while True:
                  try:
                      msg = self.pipe.recv_multipart(flags=zmq.NOBLOCK)
                  except zmq.Again:
                      break
  
                  terminate = self._handle_pipe(msg)
                  if terminate:
                      break
              if terminate:
                  break
  
          if zap in socks and socks[zap] == zmq.POLLIN:
              self._handle_zap()
  
      self.pipe.close()
      self.authenticator.stop()
  
imports: import time
  import logging
  from threading import Thread, Event
  import zmq
  from zmq.utils import jsonapi
  from zmq.utils.strtypes import bytes, unicode, b, u
  import sys
  from .base import Authenticator
label_desc: Use image node_id 2 for calling the AuthenticationThread obj's underlying member method code with example usage: obj.run() without return types