code: def commit(self):
          
          # Set the status to "starting" synchronously, to ensure that
          # this batch will necessarily not accept new messages.
          with self._state_lock:
              if self._status == base.BatchStatus.ACCEPTING_MESSAGES:
                  self._status = base.BatchStatus.STARTING
              else:
                  return
  
          # Start a new thread to actually handle the commit.
          commit_thread = threading.Thread(
              name="Thread-CommitBatchPublisher", target=self._commit
          )
          commit_thread.start()
docs: Actually publish all of the messages on the active batch.
  
          .. note::
  
              This method is non-blocking. It opens a new thread, which calls
              :meth:`_commit`, which does block.
  
          This synchronously sets the batch status to "starting", and then opens
          a new thread, which handles actually sending the messages to Pub/Sub.
  
          If the current batch is **not** accepting messages, this method
          does nothing.