8 bool TTKLockedFile::lock(LockMode
mode,
bool block)
11 qWarning(
"TTKLockedFile::lock(): file is not opened");
18 if (mode == m_lock_mode)
21 if (m_lock_mode != NoLock)
28 fl.l_type = (mode == ReadLock) ? F_RDLCK : F_WRLCK;
29 int cmd = block ? F_SETLKW : F_SETLK;
30 int ret = fcntl(handle(), cmd, &fl);
33 if (errno != EINTR && errno != EAGAIN)
34 qWarning(
"TTKLockedFile::lock(): fcntl: %s", strerror(errno));
42 bool TTKLockedFile::unlock()
45 qWarning(
"TTKLockedFile::unlock(): file is not opened");
57 int ret = fcntl(handle(), F_SETLKW, &fl);
60 qWarning(
"TTKLockedFile::lock(): fcntl: %s", strerror(errno));
68 TTKLockedFile::~TTKLockedFile()