summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-10-14 17:38:40 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-10-14 17:38:40 +0000
commit523ebd81f8aeecf1f2c3c477f06fd03262fb1743 (patch)
tree1bf2e677c85edc3426742e411ea25ccfd60ad4c0
parente4429c7b1d1e1acfabe1d55a6832b31a25259163 (diff)
Use an explicit event rather than event_once for the main event so it
can be removed when the client becomes ready.
-rw-r--r--usr.bin/tmux/tmux.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c
index f28800f91e2..bf8883276d4 100644
--- a/usr.bin/tmux/tmux.c
+++ b/usr.bin/tmux/tmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.c,v 1.88 2010/09/26 20:43:30 nicm Exp $ */
+/* $OpenBSD: tmux.c,v 1.89 2010/10/14 17:38:39 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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