summaryrefslogtreecommitdiffstats
authortcunha <tcunha>2010-10-24 00:31:57 (GMT)
committer Raghavendra D Prabhu <[email protected]>2011-01-02 18:59:30 (GMT)
commit63a3c966cc861ba413be9c474461b1f7c7626e8a (patch) (side-by-side diff)
tree927113d1157447a129d4cab671f831957eefcd8d
parent8917ab0e8630245bd7389fba95286a134f74a973 (diff)
downloadtmux-old-63a3c966cc861ba413be9c474461b1f7c7626e8a.zip
tmux-old-63a3c966cc861ba413be9c474461b1f7c7626e8a.tar.gz
tmux-old-63a3c966cc861ba413be9c474461b1f7c7626e8a.tar.bz2
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 (more/less context) (ignore whitespace changes)
-rw-r--r--tmux.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/tmux.c b/tmux.c
index 6de3ff3..8076eb3 100644
--- a/tmux.c
+++ b/tmux.c
@@ -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 <[email protected]>
@@ -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 *);
@@ -565,12 +566,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 */
}
@@ -603,10 +606,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