From 5bcdacfa6434439c18a7715313f07a34d61396c7 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 14 Apr 2014 13:29:04 -0700 Subject: [PATCH] Condor interface: race condition fix, from Jamie --- samples/condor/boinc_gahp.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/samples/condor/boinc_gahp.cpp b/samples/condor/boinc_gahp.cpp index f8c69e2862..552b153c0d 100644 --- a/samples/condor/boinc_gahp.cpp +++ b/samples/condor/boinc_gahp.cpp @@ -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::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++; }