MCPcopy Create free account
hub / github.com/ElementsProject/elements / LockOrUnlock

Function LockOrUnlock

src/leveldb/util/env_windows.cc:348–360  ·  view source on GitHub ↗

Lock or unlock the entire file as specified by |lock|. Returns true when successful, false upon failure. Caller should call ::GetLastError() to determine cause of failure

Source from the content-addressed store, hash-verified

346// when successful, false upon failure. Caller should call ::GetLastError()
347// to determine cause of failure
348bool LockOrUnlock(HANDLE handle, bool lock) {
349 if (lock) {
350 return ::LockFile(handle,
351 /*dwFileOffsetLow=*/0, /*dwFileOffsetHigh=*/0,
352 /*nNumberOfBytesToLockLow=*/MAXDWORD,
353 /*nNumberOfBytesToLockHigh=*/MAXDWORD);
354 } else {
355 return ::UnlockFile(handle,
356 /*dwFileOffsetLow=*/0, /*dwFileOffsetHigh=*/0,
357 /*nNumberOfBytesToLockLow=*/MAXDWORD,
358 /*nNumberOfBytesToLockHigh=*/MAXDWORD);
359 }
360}
361
362class WindowsFileLock : public FileLock {
363 public:

Callers 2

LockFileMethod · 0.70
UnlockFileMethod · 0.70

Calls 2

LockFileFunction · 0.85
UnlockFileFunction · 0.85

Tested by

no test coverage detected