blob: e46d0fd9efbe1a461f14c27450adf14016303813 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include <iostream>
#include <fstream>
//if run serially, works fine
//if run in parallel, someone will attempt to delete
//a locked file, which will fail
int main()
{
std::string fname = "lockedFile.txt";
std::fstream fout;
fout.open(fname.c_str(), std::ios::out);
for(int i = 0; i < 10000; i++)
{
fout << "x";
fout.flush();
}
fout.close();
return std::remove("lockedFile.txt");
}
|