term: wip: read from PTY in a separate thread

This allows us to buffer much more data from the client while we're
rendering.

This in turn means we're less likely to block the client from writing,
which means the client is much more likely to write all its data.

And this means we're less likely to flicker.
This commit is contained in:
Daniel Eklöf 2020-06-19 14:49:06 +02:00
parent e466063020
commit fd32fa0a0f
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 186 additions and 29 deletions

View file

@ -210,6 +210,20 @@ struct terminal {
pid_t slave;
int ptmx;
struct {
thrd_t thread_id;
mtx_t lock;
cnd_t cond;
int event_fd;
int size;
uint8_t idx;
struct {
uint8_t *data;
int len;
} buf[2];
} ptmx_read_buffer;
bool quit;
struct grid normal;
@ -226,6 +240,7 @@ struct terminal {
int font_adjustments;
enum fcft_subpixel font_subpixel;
/* TODO: rename to ptmx_write_buffer? */
tll(struct ptmx_buffer) ptmx_buffer;
enum cursor_keys cursor_keys_mode;