diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2010-10-14 17:38:39 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2010-10-14 17:38:39 +0000 |
commit | 65ff5b00bd786ca02ebfde9f76d0730acb9f68b4 (patch) | |
tree | 4601c854406b1c551c4327c4aa3d7cfe988b8314 /tmux.c | |
parent | f6cd0342f69ff47da2c298febeec59919c002eca (diff) | |
download | rtmux-65ff5b00bd786ca02ebfde9f76d0730acb9f68b4.tar.gz rtmux-65ff5b00bd786ca02ebfde9f76d0730acb9f68b4.tar.bz2 rtmux-65ff5b00bd786ca02ebfde9f76d0730acb9f68b4.zip |
Use an explicit event rather than event_once for the main event so it
can be removed when the client becomes ready.
Diffstat (limited to 'tmux.c')
-rw-r--r-- | tmux.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -61,6 +61,7 @@ char *makesockpath(const char *); __dead void shell_exec(const char *, const char *); struct imsgbuf *main_ibuf; +struct event main_event; void main_signal(int, short, unused void *); void main_callback(int, short, void *); @@ -547,12 +548,14 @@ main(int argc, char **argv) events = EV_READ; if (main_ibuf->w.queued > 0) events |= EV_WRITE; - event_once(main_ibuf->fd, events, main_callback, shellcmd, NULL); + event_set(&main_event, main_ibuf->fd, events, main_callback, shellcmd); + event_add(&main_event, NULL); event_dispatch(); - clear_signals(0); + event_del(&main_event); + clear_signals(0); client_main(); /* doesn't return */ } @@ -585,10 +588,12 @@ main_callback(unused int fd, short events, void *data) fatalx("msgbuf_write failed"); } + event_del(&main_event); events = EV_READ; if (main_ibuf->w.queued > 0) events |= EV_WRITE; - event_once(main_ibuf->fd, events, main_callback, shellcmd, NULL); + event_set(&main_event, main_ibuf->fd, events, main_callback, shellcmd); + event_add(&main_event, NULL); } void |