Let the write buffer of the underlying transport a chance to be flushed.
495882
def drain(self):
        
        data = self._stream.getvalue()
        if len(data):
            yield from self._protocol.send(data)
        self._stream = io.BytesIO(b'')
1303622
public void flushBuffer()
  {
    Writer out = this.out;
    if (out == null)
      return;

    try {
      if (out instanceof FlushBuffer)
        ((FlushBuffer) out).flushBuffer();
    } catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);
    }
  }
877216
def dispatch_write(self, buf):
        """"""
        self.write_buffer += buf
        if len(self.write_buffer) > self.MAX_BUFFER_SIZE:
            console_output('Buffer too big ({:d}) for {}\n'.format(
                len(self.write_buffer), str(self)).encode())
            raise asyncore.ExitNow(1)
        return True
296054
def enable_writes(self):
        """"""
        self.write_buffer = []
        self.flush_lock = threading.RLock()
        self.flush_thread = FlushThread(self.max_batch_time,
                                        self._flush_writes)
454167
def flush_buffers(self):
    """"""
    while True:
      try:
        self.read(FLUSH_READ_SIZE, timeout_ms=10)
      except usb_exceptions.LibusbWrappingError as exception:
        if exception.is_timeout():
          break
        raise
284772
protected synchronized void flushBuffer(boolean chunkComplete,
      boolean keepPartialData) throws IOException {
    if (count != 0) {
      int chunkLen = count;
      count = 0;
      writeChecksumChunk(buf, 0, chunkLen, keepPartialData && !chunkComplete);
      if (!chunkComplete) {
        if (!keepPartialData) {
          bytesSentInChunk += chunkLen;
        } else {
          count = chunkLen;
        }
      } else {
        bytesSentInChunk = 0;
      }
    }
  }
353046
def _flush(self):
        """"""
        self._buffer.sort()
        self._replace_batch()
        self._buffer = []
        self._compress()
1223009
def _flush_raw_or_buffered(self):
        
        # Flush only if bytes written
        # This avoid no required process/thread
        # creation and network call.
        # This step is performed by raw stream.
        if self._buffer_seek and self._seek:
            self._seek += 1
            with handle_os_exceptions():
                self._flush()

        # If data lower than buffer size
        # flush data with raw stream to reduce IO calls
        elif self._buffer_seek:
            self._raw._write_buffer = self._get_buffer()
            self._raw._seek = self._buffer_seek
            self._raw.flush()
1251507
def on_writable
      begin
        @_write_buffer.write_to(@_io)
      rescue Errno::EINTR
        return

      # SystemCallError catches Errno::EPIPE & Errno::ECONNRESET amongst others.
      rescue SystemCallError, IOError, SocketError
        return close
      end

      if @_write_buffer.empty?
        disable_write_watcher
        on_write_complete
      end
    end
1076769
def flush(self):
        
        if self._writable:
            with self._seek_lock:
                buffer = self._get_buffer()

                # Flush that part of the file
                end = self._seek
                start = end - len(buffer)

                # Clear buffer
                self._write_buffer = bytearray()

            # Flush content
            with handle_os_exceptions():
                self._flush(buffer, start, end)
936304
def write(self, message, flush=False):
        """"""
        # this need be threadsafe because the concurrent spinning running on
        # the stderr
        with self.lock:
            self.paralell_stream.erase()
            super(Clean, self).write(message, flush)
758834
function () {
    var self = this;
    if (!self._waitingForQuiescence())
      self._flushBufferedWrites();
    _.each(self._stores, function (s) {
      s.saveOriginals();
    });
  }
178870
protected function flushWriteBuffer()
    {
        if ($this->flushWriteBufferPromise) {
            return $this->flushWriteBufferPromise;

        } else {
            $deferred = new Promise\Deferred();

            $this->eventLoop->addWriteStream($this->getStream(), function ($stream) use ($deferred) {
                try {
                    $this->write();

                    if ($this->writeBuffer->isEmpty()) {
                        $this->eventLoop->removeWriteStream($stream);
                        $this->flushWriteBufferPromise = null;
                        $deferred->resolve(true);
                    }

                } catch (\Exception $e) {
                    $this->eventLoop->removeWriteStream($stream);
                    $this->flushWriteBufferPromise = null;
                    $deferred->reject($e);
                }
            });

            return $this->flushWriteBufferPromise = $deferred->promise();
        }
    }
541087
protected synchronized void flushPendingWriteRequests() throws Exception {
        LOGGER.debug(" flushPendingWriteRequests()");

        if (writeRequestQueue == null) {
            return;
        }

        Event scheduledWrite;
        while ((scheduledWrite = writeRequestQueue.poll()) != null) {
            LOGGER.debug(" Flushing buffered write request: {}",
                    scheduledWrite.data);

            getProxyFilter().filterWrite(scheduledWrite.nextFilter,
                    getSession(), (WriteRequest) scheduledWrite.data);
        }

        // Free queue
        writeRequestQueue = null;
    }
284935
public void flush() {
    lock.writeLock().lock();
    try {
      OMMapBufferEntry entry;
      for (Iterator<OMMapBufferEntry> it = bufferPoolLRU.iterator(); it.hasNext();) {
        entry = it.next();
        if (entry.file != null && entry.file.isClosed()) {
          if (removeEntry(entry))
            it.remove();
        }
      }
    } finally {
      lock.writeLock().unlock();
    }
  }
399339
def flush(self):
        
        self.acquire()
        try:
            if self.outStream and hasattr(self.outStream, "flush"):
                self.outStream.flush()
            if self.errStream and hasattr(self.errStream, "flush"):
                self.errStream.flush()
        finally:
            self.release()
1358919
def _write_flush(self, fd, payload=None):
    """"""
    try:
      if payload:
        fd.write(ensure_binary(payload))
      fd.flush()
    except (IOError, OSError) as e:
      # If a `Broken Pipe` is encountered during a stdio fd write, we're headless - bail.
      if e.errno == errno.EPIPE and self._exit_on_broken_pipe:
        sys.exit()
      # Otherwise, re-raise.
      raise