Related to #55, but not quite the same ... using lfs.mkdir() is not thread safe. Because it is not idempotent it is quite common to wrap it in a check such as:
if not lfs.attributes(path, "mode") == "directory" then
lfs.mkdir(path)
end
Unfortunately in a multi-threaded environment is is possible for the directory check to return false but another thread to create the directory in the intervening milliseconds.
A new flag needs to be added so that ERROR_FILE_EXISTS is considered a success because no operation was needed. It's likely the existing syscalls can be leveraged by passing the right flags so the success is properly reported.
Related to #55, but not quite the same ... using
lfs.mkdir()
is not thread safe. Because it is not idempotent it is quite common to wrap it in a check such as:Unfortunately in a multi-threaded environment is is possible for the directory check to return false but another thread to create the directory in the intervening milliseconds.
A new flag needs to be added so that
ERROR_FILE_EXISTS
is considered a success because no operation was needed. It's likely the existing syscalls can be leveraged by passing the right flags so the success is properly reported.