Hi everyone,
I am working on ubuntu 12.04 64.
And I am looking for a class or a function to lock a QFile across PROCESSES, not threads.
There used to be a range of classes performing the similar functionalities, but I can't see them available in Qt4.8:
- QSystemReadWriteLock
- QLock
- QtLockedFile
- QSystemMutex
I wonder where have they gone, and why.
QSystemSemaphore does not work in my case, since the other processes accessing the file is not written in Qt.
I tried to use the C solution, fcntl(fd, F_SETLKW, &lock);
but it always return -1 (error) if the file is opened by QFile. Although it works using the function open() from C libs.
I can understand it used to work, as I found some Q classes using it in the past.
Currently I am counting on QxtFileLock to provide the same functionality, but there would be an additional lib in my system and would not be the best thing to do in my case.
but it struggles for me to understand the reason to remove file locking functionalities from Qt.
Or does it exist somewhere that I haven't find so far?
Thank you very much and hope to find a nice and neat solution in my working case.
Cheers.
Lan
Bookmarks