diff options
author | Tiago Cunha <tcunha@gmx.com> | 2010-10-24 00:31:57 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2010-10-24 00:31:57 +0000 |
commit | e7a4b68f7384cb81e7533afeeb490b924663e96f (patch) | |
tree | 0ce5db9a789ccb6bfb6be968355c7b00c4cea64e /tmux.c | |
parent | a7e5092bd4f8f6625499d2a4c9f6bc47ac298a00 (diff) | |
download | rtmux-e7a4b68f7384cb81e7533afeeb490b924663e96f.tar.gz rtmux-e7a4b68f7384cb81e7533afeeb490b924663e96f.tar.bz2 rtmux-e7a4b68f7384cb81e7533afeeb490b924663e96f.zip |
Sync OpenBSD patchset 773:
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 | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -1,4 +1,4 @@ -/* $Id: tmux.c,v 1.216 2010-10-09 14:29:32 tcunha Exp $ */ +/* $Id: tmux.c,v 1.217 2010-10-24 00:31:57 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -60,6 +60,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 *); @@ -564,12 +565,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 */ } @@ -602,10 +605,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 |