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:
Ray Speth 2016-03-30 20:35:15 -04:00
parent 2bfbd73a12
commit 05198ddcfb

View file

@ -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);