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

Function LockOrUnlock

src/leveldb/util/env_posix.cc:452–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450};
451
452int LockOrUnlock(int fd, bool lock) {
453 errno = 0;
454 struct ::flock file_lock_info;
455 std::memset(&file_lock_info, 0, sizeof(file_lock_info));
456 file_lock_info.l_type = (lock ? F_WRLCK : F_UNLCK);
457 file_lock_info.l_whence = SEEK_SET;
458 file_lock_info.l_start = 0;
459 file_lock_info.l_len = 0; // Lock/unlock entire file.
460 return ::fcntl(fd, F_SETLK, &file_lock_info);
461}
462
463// Instances are thread-safe because they are immutable.
464class PosixFileLock : public FileLock {

Callers 2

LockFileMethod · 0.70
UnlockFileMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected