Condor interface: race condition fix, from Jamie

This commit is contained in:
David Anderson 2014-04-14 13:29:04 -07:00
parent 65ec42da6c
commit 5bcdacfa64
1 changed files with 5 additions and 2 deletions

View File

@ -707,14 +707,17 @@ int handle_command(char* p) {
exit(0);
} else if (!strcasecmp(cmd, "RESULTS")) {
flockfile(stdout);
BPRINTF("S %d\n", n_results());
int cnt = n_results();
BPRINTF("S %d\n", cnt);
vector<COMMAND*>::iterator i = commands.begin();
while (i != commands.end()) {
int j = 0;
while (i != commands.end() && j < cnt) {
COMMAND *c2 = *i;
if (c2->out) {
BPRINTF("%d %s\n", c2->id, c2->out);
delete c2;
i = commands.erase(i);
j++;
} else {
i++;
}