CMake/Tests/CTestTestParallel/lockFile.c

20 lines
375 B
C
Raw Normal View History

#include <stdio.h>
2009-09-23 22:07:57 +04:00
/*if run serially, works fine.
If run in parallel, someone will attempt to delete
a locked file, which will fail */
int main(void)
{
FILE* file;
int i;
const char* fname = "lockedFile.txt";
file = fopen(fname, "w");
for (i = 0; i < 10000; i++) {
fprintf(file, "%s", "x");
fflush(file);
}
fclose(file);
return remove(fname);
}