diff options
Diffstat (limited to 'vespalib/src/vespa/fastos/linux_file.h')
-rw-r--r-- | vespalib/src/vespa/fastos/linux_file.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/vespalib/src/vespa/fastos/linux_file.h b/vespalib/src/vespa/fastos/linux_file.h index 51bf2a170c7..af6e6af51af 100644 --- a/vespalib/src/vespa/fastos/linux_file.h +++ b/vespalib/src/vespa/fastos/linux_file.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. /** ****************************************************************************** * @author Oivind H. Danielsen @@ -10,21 +10,23 @@ #pragma once #include "unix_file.h" +#include <atomic> /** * This is the Linux implementation of @ref FastOS_File. Most * methods are inherited from @ref FastOS_UNIX_File. */ -class FastOS_Linux_File : public FastOS_UNIX_File +class FastOS_Linux_File final : public FastOS_UNIX_File { public: using FastOS_UNIX_File::ReadBuf; protected: - int64_t _cachedSize; + std::atomic<int64_t> _cachedSize; int64_t _filePointer; // Only maintained/used in directio mode public: - FastOS_Linux_File (const char *filename = nullptr); + FastOS_Linux_File() : FastOS_Linux_File(nullptr) {} + explicit FastOS_Linux_File(const char *filename); ~FastOS_Linux_File () override; bool GetDirectIORestrictions(size_t &memoryAlignment, size_t &transferGranularity, size_t &transferMaximum) override; bool DirectIOPadding(int64_t offset, size_t length, size_t &padBefore, size_t &padAfter) override; |