Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

class libtmux-swift latest

DescriptorDrain

Reads a descriptor until it is told to stop, and proves it has stopped before the descriptor can be closed.

Source and package
Qualified name
DescriptorDrain
Package
libtmux-swift
Source
Tests/TmuxFixture/DescriptorDrain.swift
class DescriptorDrain : class DescriptorDrain

Description#

Draining a pseudo-terminal keeps its client from blocking on a full buffer. A reader that loops on read(descriptor) while another thread closes the descriptor does not stop: its next call lands on whatever the process opened next under the same number, and it consumes that file's bytes. In a suite that spawns tmux servers concurrently, the number is soon a pipe carrying another case's reply, so a listing arrives short or a command's marker line never arrives, in a case that has nothing to do with this one.

stop() returns only after the reader has left its loop, so the caller can close the descriptor afterwards without a reader outliving it.

Members2#

  • init(reading:) method Starts reading descriptor, which the caller keeps open until stop() has returned. The descriptor is made non-blocking so the reader can notice a stop request instead of sitting in read through it.
  • stop() method Stops the reader and waits until it has exited. Safe to call once.
Esc

Type to search.

Reference previewOpen reference