Step **waiting;
Step **errorstep;
- waiting = malloc(sizeof(Step *) * testspec->nsessions);
- errorstep = malloc(sizeof(Step *) * testspec->nsessions);
-
/*
* In dry run mode, just display the permutation in the same format used
* by spec files, and return.
return;
}
+ waiting = malloc(sizeof(Step *) * testspec->nsessions);
+ errorstep = malloc(sizeof(Step *) * testspec->nsessions);
+
printf("\nstarting permutation:");
for (i = 0; i < nsteps; i++)
printf(" %s", steps[i]->name);
* Check whether the session that needs to perform the next step
* is still blocked on an earlier step. If so, wait for it to finish.
*
- * In older versions of this tool, when allowed precisely one session
- * to be waiting at a time. If we reached a step which required that
+ * (In older versions of this tool, we allowed precisely one session
+ * to be waiting at a time. If we reached a step that required that
* session to execute the next command, we would declare the whole
- * permutation invalid, cancel everything, and move on to the next one.
- * Unfortunately, that made it impossible to test the deadlock detector
- * using this framework unless the numebr of processes involved in the
- * deadlock was precisely two. We now assume that if we reach a step
- * that is still blocked, we need to wait for it to unblock itself.
+ * permutation invalid, cancel everything, and move on to the next
+ * one. Unfortunately, that made it impossible to test the deadlock
+ * detector using this framework, unless the number of processes
+ * involved in the deadlock was precisely two. We now assume that if
+ * we reach a step that is still blocked, we need to wait for it to
+ * unblock itself.)
*/
for (w = 0; w < nwaiting; ++w)
{
}
PQclear(res);
}
+
+ free(waiting);
+ free(errorstep);
}
/*
if (td > 60 * USECS_PER_SEC && !canceled)
{
PGcancel *cancel = PQgetCancel(conn);
- char buf[256];
- if (cancel != NULL && !PQcancel(cancel, buf, sizeof(buf)))
- fprintf(stderr, "PQcancel failed: %s\n", buf);
if (cancel != NULL)
+ {
+ char buf[256];
+
+ if (PQcancel(cancel, buf, sizeof(buf)))
+ canceled = true;
+ else
+ fprintf(stderr, "PQcancel failed: %s\n", buf);
PQfreeCancel(cancel);
+ }
}
/*