Fix get_modified_time to avoid race condition on Windows
If multiple processes tried to read the same input file simultaneously, get_modified_time would fail. With this change, get_modified_time does not need to actually open the file in order to read the metadata.
This commit is contained in:
parent
2bfbd73a12
commit
05198ddcfb
1 changed files with 1 additions and 1 deletions
|
|
@ -36,7 +36,7 @@ static std::mutex xml_mutex;
|
|||
|
||||
static int get_modified_time(const std::string& path) {
|
||||
#ifdef _WIN32
|
||||
HANDLE hFile = CreateFile(path.c_str(), GENERIC_READ, FILE_SHARE_WRITE,
|
||||
HANDLE hFile = CreateFile(path.c_str(), NULL, NULL,
|
||||
NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (hFile == INVALID_HANDLE_VALUE) {
|
||||
throw CanteraError("get_modified_time", "Couldn't open file:" + path);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue