'Performs the work of a DataSourceThread.'

def PerformWork(self):

    if self.progress_generator_factory:
        progress_gen = self.progress_generator_factory()
    else:
        progress_gen = None
    content_gen = self.workitem_generator_factory(self.request_manager, self.progress_queue, progress_gen, self.kinds)
    self.xfer_count = 0
    self.read_count = 0
    self.read_all = False
    for item in content_gen.Batches():
        item.MarkAsRead()
        while (not self.exit_flag):
            try:
                self.thread_pool.SubmitItem(item, block=True, timeout=1.0)
                self.entity_count += item.count
                break
            except Queue.Full:
                pass
        if self.exit_flag:
            break
    if (not self.exit_flag):
        self.read_all = True
    self.read_count = content_gen.row_count
    self.xfer_count = content_gen.xfer_count
