Boost logo

Boost Users :

Subject: [Boost-users] [Interprocess] Problem with file_lock on Linux
From: Jan Niklas Hasse (j.hasse_at_[hidden])
Date: 2015-08-27 07:25:22


The following code

#include <boost/interprocess/sync/file_lock.hpp>
#include <iostream>
#include <fstream>

int main() {
     std::ofstream file("test.lock");
     boost::interprocess::file_lock flock("test.lock");
     std::cout << flock.try_lock();
     std::cout << flock.try_lock() << std::endl;
}

outputs 10 on Windows and 11 on Linux. Shouldn't it also print 10 on
Linux or am I missunderstanding file_lock? I've also tried locking from
different threads, but no luck.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net