[io_engine] Add exclusive flag to io_engine

This commit is contained in:
Joe Thornber
2016-06-07 13:45:27 +01:00
parent df9f4d479d
commit 07f44e9c77
3 changed files with 13 additions and 7 deletions

View File

@ -75,9 +75,11 @@ aio_engine::~aio_engine()
}
aio_engine::handle
aio_engine::open_file(std::string const &path, mode m)
aio_engine::open_file(std::string const &path, mode m, sharing s)
{
int flags = (m == READ_ONLY) ? O_RDONLY : O_RDWR;
if (s == EXCLUSIVE)
flags |= O_EXCL;
int fd = ::open(path.c_str(), O_DIRECT | flags);
if (fd < 0) {
ostringstream out;