90 : lockname_(lockname), fd_(-1), locked_(false) {
92 fd_ = open(lockname_.c_str(), O_RDONLY | O_CREAT, 0600);
94 if ((errno == ENOENT) && !blocking) {
99 std::string errmsg = strerror(errno);
101 << lockname_ <<
"': " << errmsg);
105 int ret = flock(fd_, LOCK_EX | (blocking ? 0 : LOCK_NB));
110 if (errno != EWOULDBLOCK) {
111 std::string errmsg = strerror(errno);
113 << lockname_ <<
"': " << errmsg);