|
|
|
@ -48,7 +48,8 @@ ThreadStatusUpdater* CreateThreadStatusUpdater() { |
|
|
|
|
|
|
|
|
|
namespace { |
|
|
|
|
|
|
|
|
|
static const size_t kSectorSize = 512; // Sector size used when physical sector size could not be obtained from device.
|
|
|
|
|
// Sector size used when physical sector size cannot be obtained from device.
|
|
|
|
|
static const size_t kSectorSize = 512; |
|
|
|
|
|
|
|
|
|
// RAII helpers for HANDLEs
|
|
|
|
|
const auto CloseHandleFunc = [](HANDLE h) { ::CloseHandle(h); }; |
|
|
|
@ -96,7 +97,8 @@ WinEnvIO::WinEnvIO(Env* hosted_env) |
|
|
|
|
|
|
|
|
|
HMODULE module = GetModuleHandle("kernel32.dll"); |
|
|
|
|
if (module != NULL) { |
|
|
|
|
GetSystemTimePreciseAsFileTime_ = (FnGetSystemTimePreciseAsFileTime)GetProcAddress( |
|
|
|
|
GetSystemTimePreciseAsFileTime_ = |
|
|
|
|
(FnGetSystemTimePreciseAsFileTime)GetProcAddress( |
|
|
|
|
module, "GetSystemTimePreciseAsFileTime"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -195,8 +197,8 @@ Status WinEnvIO::NewRandomAccessFile(const std::string& fname, |
|
|
|
|
HANDLE hFile = 0; |
|
|
|
|
{ |
|
|
|
|
IOSTATS_TIMER_GUARD(open_nanos); |
|
|
|
|
hFile = |
|
|
|
|
RX_CreateFile(RX_FN(fname).c_str(), GENERIC_READ, |
|
|
|
|
hFile = RX_CreateFile( |
|
|
|
|
RX_FN(fname).c_str(), GENERIC_READ, |
|
|
|
|
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, |
|
|
|
|
NULL, OPEN_EXISTING, fileFlags, NULL); |
|
|
|
|
} |
|
|
|
@ -224,7 +226,7 @@ Status WinEnvIO::NewRandomAccessFile(const std::string& fname, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HANDLE hMap = RX_CreateFileMapping(hFile, NULL, PAGE_READONLY, |
|
|
|
|
0, // Whole file at its present length
|
|
|
|
|
0, // At its present length
|
|
|
|
|
0, |
|
|
|
|
NULL); // Mapping name
|
|
|
|
|
|
|
|
|
@ -259,7 +261,9 @@ Status WinEnvIO::NewRandomAccessFile(const std::string& fname, |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
result->reset(new WinRandomAccessFile(fname, hFile, |
|
|
|
|
std::max(GetSectorSize(fname), page_size_), options)); |
|
|
|
|
std::max(GetSectorSize(fname), |
|
|
|
|
page_size_), |
|
|
|
|
options)); |
|
|
|
|
fileGuard.release(); |
|
|
|
|
} |
|
|
|
|
return s; |
|
|
|
@ -313,7 +317,8 @@ Status WinEnvIO::OpenWritableFile(const std::string& fname, |
|
|
|
|
desired_access, // Access desired
|
|
|
|
|
shared_mode, |
|
|
|
|
NULL, // Security attributes
|
|
|
|
|
creation_disposition, // Posix env says (reopen) ? (O_CREATE | O_APPEND) : O_CREAT | O_TRUNC
|
|
|
|
|
// Posix env says (reopen) ? (O_CREATE | O_APPEND) : O_CREAT | O_TRUNC
|
|
|
|
|
creation_disposition, |
|
|
|
|
fileFlags, // Flags
|
|
|
|
|
NULL); // Template File
|
|
|
|
|
} |
|
|
|
@ -332,7 +337,8 @@ Status WinEnvIO::OpenWritableFile(const std::string& fname, |
|
|
|
|
if (!ret) { |
|
|
|
|
auto lastError = GetLastError(); |
|
|
|
|
return IOErrorFromWindowsError( |
|
|
|
|
"Failed to create a ReopenWritableFile move to the end: " + fname, lastError); |
|
|
|
|
"Failed to create a ReopenWritableFile move to the end: " + fname, |
|
|
|
|
lastError); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -344,14 +350,17 @@ Status WinEnvIO::OpenWritableFile(const std::string& fname, |
|
|
|
|
} else { |
|
|
|
|
// Here we want the buffer allocation to be aligned by the SSD page size
|
|
|
|
|
// and to be a multiple of it
|
|
|
|
|
result->reset(new WinWritableFile(fname, hFile, std::max(GetSectorSize(fname), GetPageSize()), |
|
|
|
|
result->reset(new WinWritableFile(fname, hFile, |
|
|
|
|
std::max(GetSectorSize(fname), |
|
|
|
|
GetPageSize()), |
|
|
|
|
c_BufferCapacity, local_options)); |
|
|
|
|
} |
|
|
|
|
return s; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Status WinEnvIO::NewRandomRWFile(const std::string & fname, |
|
|
|
|
std::unique_ptr<RandomRWFile>* result, const EnvOptions & options) { |
|
|
|
|
std::unique_ptr<RandomRWFile>* result, |
|
|
|
|
const EnvOptions & options) { |
|
|
|
|
|
|
|
|
|
Status s; |
|
|
|
|
|
|
|
|
@ -388,14 +397,17 @@ Status WinEnvIO::NewRandomRWFile(const std::string & fname, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UniqueCloseHandlePtr fileGuard(hFile, CloseHandleFunc); |
|
|
|
|
result->reset(new WinRandomRWFile(fname, hFile, std::max(GetSectorSize(fname), GetPageSize()), |
|
|
|
|
result->reset(new WinRandomRWFile(fname, hFile, |
|
|
|
|
std::max(GetSectorSize(fname), |
|
|
|
|
GetPageSize()), |
|
|
|
|
options)); |
|
|
|
|
fileGuard.release(); |
|
|
|
|
|
|
|
|
|
return s; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Status WinEnvIO::NewMemoryMappedFileBuffer(const std::string & fname, |
|
|
|
|
Status WinEnvIO::NewMemoryMappedFileBuffer( |
|
|
|
|
const std::string & fname, |
|
|
|
|
std::unique_ptr<MemoryMappedFileBuffer>* result) { |
|
|
|
|
Status s; |
|
|
|
|
result->reset(); |
|
|
|
@ -416,8 +428,8 @@ Status WinEnvIO::NewMemoryMappedFileBuffer(const std::string & fname, |
|
|
|
|
|
|
|
|
|
if (INVALID_HANDLE_VALUE == hFile) { |
|
|
|
|
auto lastError = GetLastError(); |
|
|
|
|
s = IOErrorFromWindowsError("Failed to open NewMemoryMappedFileBuffer: " + fname, |
|
|
|
|
lastError); |
|
|
|
|
s = IOErrorFromWindowsError( |
|
|
|
|
"Failed to open NewMemoryMappedFileBuffer: " + fname, lastError); |
|
|
|
|
return s; |
|
|
|
|
} |
|
|
|
|
UniqueCloseHandlePtr fileGuard(hFile, CloseHandleFunc); |
|
|
|
@ -429,13 +441,15 @@ Status WinEnvIO::NewMemoryMappedFileBuffer(const std::string & fname, |
|
|
|
|
} |
|
|
|
|
// Will not map empty files
|
|
|
|
|
if (fileSize == 0) { |
|
|
|
|
return Status::NotSupported("NewMemoryMappedFileBuffer can not map zero length files: " + fname); |
|
|
|
|
return Status::NotSupported( |
|
|
|
|
"NewMemoryMappedFileBuffer can not map zero length files: " + fname); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// size_t is 32-bit with 32-bit builds
|
|
|
|
|
if (fileSize > std::numeric_limits<size_t>::max()) { |
|
|
|
|
return Status::NotSupported( |
|
|
|
|
"The specified file size does not fit into 32-bit memory addressing: " + fname); |
|
|
|
|
"The specified file size does not fit into 32-bit memory addressing: " |
|
|
|
|
+ fname); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HANDLE hMap = RX_CreateFileMapping(hFile, NULL, PAGE_READWRITE, |
|
|
|
@ -446,8 +460,7 @@ Status WinEnvIO::NewMemoryMappedFileBuffer(const std::string & fname, |
|
|
|
|
if (!hMap) { |
|
|
|
|
auto lastError = GetLastError(); |
|
|
|
|
return IOErrorFromWindowsError( |
|
|
|
|
"Failed to create file mapping for NewMemoryMappedFileBuffer: " + fname, |
|
|
|
|
lastError); |
|
|
|
|
"Failed to create file mapping for: " + fname, lastError); |
|
|
|
|
} |
|
|
|
|
UniqueCloseHandlePtr mapGuard(hMap, CloseHandleFunc); |
|
|
|
|
|
|
|
|
@ -464,8 +477,8 @@ Status WinEnvIO::NewMemoryMappedFileBuffer(const std::string & fname, |
|
|
|
|
lastError); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
result->reset(new WinMemoryMappedBuffer(hFile, hMap,
|
|
|
|
|
base, static_cast<size_t>(fileSize))); |
|
|
|
|
result->reset(new WinMemoryMappedBuffer(hFile, hMap, base, |
|
|
|
|
static_cast<size_t>(fileSize))); |
|
|
|
|
|
|
|
|
|
mapGuard.release(); |
|
|
|
|
fileGuard.release(); |
|
|
|
@ -489,7 +502,8 @@ Status WinEnvIO::NewDirectory(const std::string& name, |
|
|
|
|
// 0 - for access means read metadata
|
|
|
|
|
{ |
|
|
|
|
IOSTATS_TIMER_GUARD(open_nanos); |
|
|
|
|
handle = RX_CreateFile(RX_FN(name).c_str(), 0, |
|
|
|
|
handle = RX_CreateFile( |
|
|
|
|
RX_FN(name).c_str(), 0, |
|
|
|
|
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, |
|
|
|
|
NULL, |
|
|
|
|
OPEN_EXISTING, |
|
|
|
@ -499,8 +513,7 @@ Status WinEnvIO::NewDirectory(const std::string& name, |
|
|
|
|
|
|
|
|
|
if (INVALID_HANDLE_VALUE == handle) { |
|
|
|
|
auto lastError = GetLastError(); |
|
|
|
|
s = IOErrorFromWindowsError( |
|
|
|
|
"open folder: " + name, lastError); |
|
|
|
|
s = IOErrorFromWindowsError("open folder: " + name, lastError); |
|
|
|
|
return s; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -515,7 +528,8 @@ Status WinEnvIO::FileExists(const std::string& fname) { |
|
|
|
|
// which is consistent with _access() impl on windows
|
|
|
|
|
// but can be added
|
|
|
|
|
WIN32_FILE_ATTRIBUTE_DATA attrs; |
|
|
|
|
if (FALSE == RX_GetFileAttributesEx(RX_FN(fname).c_str(), GetFileExInfoStandard, &attrs)) { |
|
|
|
|
if (FALSE == RX_GetFileAttributesEx(RX_FN(fname).c_str(), |
|
|
|
|
GetFileExInfoStandard, &attrs)) { |
|
|
|
|
auto lastError = GetLastError(); |
|
|
|
|
switch (lastError) { |
|
|
|
|
case ERROR_ACCESS_DENIED: |
|
|
|
@ -546,7 +560,8 @@ Status WinEnvIO::GetChildren(const std::string& dir, |
|
|
|
|
pattern.append("\\").append("*"); |
|
|
|
|
|
|
|
|
|
HANDLE handle = RX_FindFirstFileEx(RX_FN(pattern).c_str(), |
|
|
|
|
FindExInfoBasic, // Do not want alternative name
|
|
|
|
|
// Do not want alternative name
|
|
|
|
|
FindExInfoBasic, |
|
|
|
|
&data, |
|
|
|
|
FindExSearchNameMatch, |
|
|
|
|
NULL, // lpSearchFilter
|
|
|
|
@ -631,7 +646,8 @@ Status WinEnvIO::DeleteDir(const std::string& name) { |
|
|
|
|
BOOL ret = RX_RemoveDirectory(RX_FN(name).c_str()); |
|
|
|
|
if (!ret) { |
|
|
|
|
auto lastError = GetLastError(); |
|
|
|
|
result = IOErrorFromWindowsError("Failed to remove dir: " + name, lastError); |
|
|
|
|
result = IOErrorFromWindowsError("Failed to remove dir: " + name, |
|
|
|
|
lastError); |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -641,7 +657,8 @@ Status WinEnvIO::GetFileSize(const std::string& fname, |
|
|
|
|
Status s; |
|
|
|
|
|
|
|
|
|
WIN32_FILE_ATTRIBUTE_DATA attrs; |
|
|
|
|
if (RX_GetFileAttributesEx(RX_FN(fname).c_str(), GetFileExInfoStandard, &attrs)) { |
|
|
|
|
if (RX_GetFileAttributesEx(RX_FN(fname).c_str(), GetFileExInfoStandard, |
|
|
|
|
&attrs)) { |
|
|
|
|
ULARGE_INTEGER file_size; |
|
|
|
|
file_size.HighPart = attrs.nFileSizeHigh; |
|
|
|
|
file_size.LowPart = attrs.nFileSizeLow; |
|
|
|
@ -676,7 +693,8 @@ Status WinEnvIO::GetFileModificationTime(const std::string& fname, |
|
|
|
|
Status s; |
|
|
|
|
|
|
|
|
|
WIN32_FILE_ATTRIBUTE_DATA attrs; |
|
|
|
|
if (RX_GetFileAttributesEx(RX_FN(fname).c_str(), GetFileExInfoStandard, &attrs)) { |
|
|
|
|
if (RX_GetFileAttributesEx(RX_FN(fname).c_str(), GetFileExInfoStandard, |
|
|
|
|
&attrs)) { |
|
|
|
|
*file_mtime = FileTimeToUnixTime(attrs.ftLastWriteTime); |
|
|
|
|
} else { |
|
|
|
|
auto lastError = GetLastError(); |
|
|
|
@ -694,7 +712,8 @@ Status WinEnvIO::RenameFile(const std::string& src, |
|
|
|
|
|
|
|
|
|
// rename() is not capable of replacing the existing file as on Linux
|
|
|
|
|
// so use OS API directly
|
|
|
|
|
if (!RX_MoveFileEx(RX_FN(src).c_str(), RX_FN(target).c_str(), MOVEFILE_REPLACE_EXISTING)) { |
|
|
|
|
if (!RX_MoveFileEx(RX_FN(src).c_str(), RX_FN(target).c_str(), |
|
|
|
|
MOVEFILE_REPLACE_EXISTING)) { |
|
|
|
|
DWORD lastError = GetLastError(); |
|
|
|
|
|
|
|
|
|
std::string text("Failed to rename: "); |
|
|
|
@ -765,7 +784,8 @@ Status WinEnvIO::AreFilesSame(const std::string& first, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 0 - for access means read metadata
|
|
|
|
|
HANDLE file_1 = RX_CreateFile(RX_FN(first).c_str(), 0,
|
|
|
|
|
HANDLE file_1 = RX_CreateFile( |
|
|
|
|
RX_FN(first).c_str(), 0, |
|
|
|
|
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, |
|
|
|
|
NULL, |
|
|
|
|
OPEN_EXISTING, |
|
|
|
@ -774,13 +794,13 @@ Status WinEnvIO::AreFilesSame(const std::string& first, |
|
|
|
|
|
|
|
|
|
if (INVALID_HANDLE_VALUE == file_1) { |
|
|
|
|
auto lastError = GetLastError(); |
|
|
|
|
s = IOErrorFromWindowsError( |
|
|
|
|
"open file: " + first, lastError); |
|
|
|
|
s = IOErrorFromWindowsError("open file: " + first, lastError); |
|
|
|
|
return s; |
|
|
|
|
} |
|
|
|
|
UniqueCloseHandlePtr g_1(file_1, CloseHandleFunc); |
|
|
|
|
|
|
|
|
|
HANDLE file_2 = RX_CreateFile(RX_FN(second).c_str(), 0, |
|
|
|
|
HANDLE file_2 = RX_CreateFile( |
|
|
|
|
RX_FN(second).c_str(), 0, |
|
|
|
|
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, |
|
|
|
|
NULL, OPEN_EXISTING, |
|
|
|
|
FILE_FLAG_BACKUP_SEMANTICS, // make opening folders possible
|
|
|
|
@ -788,8 +808,7 @@ Status WinEnvIO::AreFilesSame(const std::string& first, |
|
|
|
|
|
|
|
|
|
if (INVALID_HANDLE_VALUE == file_2) { |
|
|
|
|
auto lastError = GetLastError(); |
|
|
|
|
s = IOErrorFromWindowsError( |
|
|
|
|
"open file: " + second, lastError); |
|
|
|
|
s = IOErrorFromWindowsError("open file: " + second, lastError); |
|
|
|
|
return s; |
|
|
|
|
} |
|
|
|
|
UniqueCloseHandlePtr g_2(file_2, CloseHandleFunc); |
|
|
|
@ -800,8 +819,7 @@ Status WinEnvIO::AreFilesSame(const std::string& first, |
|
|
|
|
|
|
|
|
|
if (!result) { |
|
|
|
|
auto lastError = GetLastError(); |
|
|
|
|
s = IOErrorFromWindowsError( |
|
|
|
|
"stat file: " + first, lastError); |
|
|
|
|
s = IOErrorFromWindowsError("stat file: " + first, lastError); |
|
|
|
|
return s; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -811,13 +829,13 @@ Status WinEnvIO::AreFilesSame(const std::string& first, |
|
|
|
|
|
|
|
|
|
if (!result) { |
|
|
|
|
auto lastError = GetLastError(); |
|
|
|
|
s = IOErrorFromWindowsError( |
|
|
|
|
"stat file: " + second, lastError); |
|
|
|
|
s = IOErrorFromWindowsError("stat file: " + second, lastError); |
|
|
|
|
return s; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (FileInfo_1.VolumeSerialNumber == FileInfo_2.VolumeSerialNumber) { |
|
|
|
|
*res = (0 == memcmp(FileInfo_1.FileId.Identifier, FileInfo_2.FileId.Identifier,
|
|
|
|
|
*res = (0 == memcmp(FileInfo_1.FileId.Identifier, |
|
|
|
|
FileInfo_2.FileId.Identifier, |
|
|
|
|
sizeof(FileInfo_1.FileId.Identifier))); |
|
|
|
|
} else { |
|
|
|
|
*res = false; |
|
|
|
@ -842,7 +860,8 @@ Status WinEnvIO::LockFile(const std::string& lockFname, |
|
|
|
|
HANDLE hFile = 0; |
|
|
|
|
{ |
|
|
|
|
IOSTATS_TIMER_GUARD(open_nanos); |
|
|
|
|
hFile = RX_CreateFile(RX_FN(lockFname).c_str(), (GENERIC_READ | GENERIC_WRITE), |
|
|
|
|
hFile = RX_CreateFile(RX_FN(lockFname).c_str(), |
|
|
|
|
(GENERIC_READ | GENERIC_WRITE), |
|
|
|
|
ExclusiveAccessON, NULL, CREATE_ALWAYS, |
|
|
|
|
FILE_ATTRIBUTE_NORMAL, NULL); |
|
|
|
|
} |
|
|
|
@ -1002,7 +1021,6 @@ Status WinEnvIO::GetHostName(char* name, uint64_t len) { |
|
|
|
|
|
|
|
|
|
Status WinEnvIO::GetAbsolutePath(const std::string& db_path, |
|
|
|
|
std::string* output_path) { |
|
|
|
|
|
|
|
|
|
// Check if we already have an absolute path
|
|
|
|
|
// For test compatibility we will consider starting slash as an
|
|
|
|
|
// absolute path
|
|
|
|
@ -1092,7 +1110,8 @@ EnvOptions WinEnvIO::OptimizeForManifestRead( |
|
|
|
|
// Returns true iff the named directory exists and is a directory.
|
|
|
|
|
bool WinEnvIO::DirExists(const std::string& dname) { |
|
|
|
|
WIN32_FILE_ATTRIBUTE_DATA attrs; |
|
|
|
|
if (RX_GetFileAttributesEx(RX_FN(dname).c_str(), GetFileExInfoStandard, &attrs)) { |
|
|
|
|
if (RX_GetFileAttributesEx(RX_FN(dname).c_str(), |
|
|
|
|
GetFileExInfoStandard, &attrs)) { |
|
|
|
|
return 0 != (attrs.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
@ -1114,8 +1133,7 @@ size_t WinEnvIO::GetSectorSize(const std::string& fname) { |
|
|
|
|
return sector_size; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HANDLE hDevice = CreateFile(devicename, 0, 0, |
|
|
|
|
nullptr, OPEN_EXISTING, |
|
|
|
|
HANDLE hDevice = CreateFile(devicename, 0, 0, nullptr, OPEN_EXISTING, |
|
|
|
|
FILE_ATTRIBUTE_NORMAL, nullptr); |
|
|
|
|
|
|
|
|
|
if (hDevice == INVALID_HANDLE_VALUE) { |
|
|
|
@ -1130,8 +1148,10 @@ size_t WinEnvIO::GetSectorSize(const std::string& fname) { |
|
|
|
|
DWORD output_bytes = 0; |
|
|
|
|
|
|
|
|
|
BOOL ret = DeviceIoControl(hDevice, IOCTL_STORAGE_QUERY_PROPERTY, |
|
|
|
|
&spropertyquery, sizeof(spropertyquery), output_buffer, |
|
|
|
|
sizeof(STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR), &output_bytes, nullptr); |
|
|
|
|
&spropertyquery, sizeof(spropertyquery), |
|
|
|
|
output_buffer, |
|
|
|
|
sizeof(STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR), |
|
|
|
|
&output_bytes, nullptr); |
|
|
|
|
|
|
|
|
|
if (ret) { |
|
|
|
|
sector_size = ((STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR *)output_buffer)->BytesPerLogicalSector; |
|
|
|
@ -1157,7 +1177,8 @@ size_t WinEnvIO::GetSectorSize(const std::string& fname) { |
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// WinEnvThreads
|
|
|
|
|
|
|
|
|
|
WinEnvThreads::WinEnvThreads(Env* hosted_env) : hosted_env_(hosted_env), thread_pools_(Env::Priority::TOTAL) { |
|
|
|
|
WinEnvThreads::WinEnvThreads(Env* hosted_env) |
|
|
|
|
: hosted_env_(hosted_env), thread_pools_(Env::Priority::TOTAL) { |
|
|
|
|
|
|
|
|
|
for (int pool_id = 0; pool_id < Env::Priority::TOTAL; ++pool_id) { |
|
|
|
|
thread_pools_[pool_id].SetThreadPriority( |
|
|
|
@ -1176,8 +1197,9 @@ WinEnvThreads::~WinEnvThreads() { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WinEnvThreads::Schedule(void(*function)(void*), void* arg, Env::Priority pri, |
|
|
|
|
void* tag, void(*unschedFunction)(void* arg)) { |
|
|
|
|
void WinEnvThreads::Schedule(void(*function)(void*), void* arg, |
|
|
|
|
Env::Priority pri, void* tag, |
|
|
|
|
void(*unschedFunction)(void* arg)) { |
|
|
|
|
assert(pri >= Env::Priority::BOTTOM && pri <= Env::Priority::HIGH); |
|
|
|
|
thread_pools_[pri].Schedule(function, arg, tag, unschedFunction); |
|
|
|
|
} |
|
|
|
@ -1272,8 +1294,7 @@ WinEnv::~WinEnv() { |
|
|
|
|
delete thread_status_updater_; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Status WinEnv::GetThreadList( |
|
|
|
|
std::vector<ThreadStatus>* thread_list) { |
|
|
|
|
Status WinEnv::GetThreadList(std::vector<ThreadStatus>* thread_list) { |
|
|
|
|
assert(thread_status_updater_); |
|
|
|
|
return thread_status_updater_->GetThreadList(thread_list); |
|
|
|
|
} |
|
|
|
@ -1309,16 +1330,19 @@ Status WinEnv::NewWritableFile(const std::string& fname, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Status WinEnv::ReopenWritableFile(const std::string& fname, |
|
|
|
|
std::unique_ptr<WritableFile>* result, const EnvOptions& options) { |
|
|
|
|
std::unique_ptr<WritableFile>* result, |
|
|
|
|
const EnvOptions& options) { |
|
|
|
|
return winenv_io_.OpenWritableFile(fname, result, options, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Status WinEnv::NewRandomRWFile(const std::string & fname, |
|
|
|
|
std::unique_ptr<RandomRWFile>* result, const EnvOptions & options) { |
|
|
|
|
std::unique_ptr<RandomRWFile>* result, |
|
|
|
|
const EnvOptions & options) { |
|
|
|
|
return winenv_io_.NewRandomRWFile(fname, result, options); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Status WinEnv::NewMemoryMappedFileBuffer(const std::string& fname, |
|
|
|
|
Status WinEnv::NewMemoryMappedFileBuffer( |
|
|
|
|
const std::string& fname, |
|
|
|
|
std::unique_ptr<MemoryMappedFileBuffer>* result) { |
|
|
|
|
return winenv_io_.NewMemoryMappedFileBuffer(fname, result); |
|
|
|
|
} |
|
|
|
|