diff options
author | Tiago Cunha <tcunha@gmx.com> | 2011-02-15 15:20:03 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2011-02-15 15:20:03 +0000 |
commit | 3d7b8105e1385c835cf0660797fe70198097e73d (patch) | |
tree | 2e5cade8fbdbc0ce2ac112b1800224710f197af1 /cmd-set-option.c | |
parent | 3b56ebce6dd4077f6527843cfc1da63614605875 (diff) |
Sync OpenBSD patchset 855:
Simplify the way jobs work and drop the persist type, so all jobs are
fire-and-forget.
Status jobs now managed with two trees of output (new and old), rather
than storing the output in the jobs themselves. When the status line is
processed any jobs which don't appear in the new tree are started and
the output from the old tree displayed. When a job finishes it updates
the new tree with its output and that is used for any subsequent
redraws. When the status interval expires, the new tree is moved to the
old so that all jobs are run again.
This fixes the "#(echo %H:%M:%S)" problem which would lead to thousands
of identical persistent jobs and high memory use (this can still be
achieved by adding "sleep 30" but that is much less likely to happen by
accident).
Diffstat (limited to 'cmd-set-option.c')
-rw-r--r-- | cmd-set-option.c | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/cmd-set-option.c b/cmd-set-option.c index 88922db7..fbf08469 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -1,4 +1,4 @@ -/* $Id: cmd-set-option.c,v 1.107 2011-01-07 15:02:38 tcunha Exp $ */ +/* $Id: cmd-set-option.c,v 1.108 2011-02-15 15:20:03 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -87,11 +87,8 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx) struct winlink *wl; struct client *c; struct options *oo; - struct jobs *jobs; - struct job *job, *nextjob; const char *optstr, *valstr; u_int i; - int try_again; /* Work out the options tree and table to use. */ if (args_has(self->args, 's')) { @@ -181,24 +178,8 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx) strcmp(oe->name, "window-status-format") == 0) { for (i = 0; i < ARRAY_LENGTH(&clients); i++) { c = ARRAY_ITEM(&clients, i); - if (c == NULL || c->session == NULL) - continue; - - jobs = &c->status_jobs; - do { - try_again = 0; - job = RB_ROOT(jobs); - while (job != NULL) { - nextjob = RB_NEXT(jobs, jobs, job); - if (job->flags & JOB_PERSIST) { - job_remove(jobs, job); - try_again = 1; - break; - } - job = nextjob; - } - } while (try_again); - server_redraw_client(c); + if (c != NULL && c->session != NULL) + server_redraw_client(c); } } |