blob: 16644fc2791f9a1b9c800cb0e6dd108eb63bf28c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <sys/types.h>
#include <fcntl.h>
#include <limits.h>
namespace ns_log {
class Lock {
private:
Lock();
Lock(const Lock &);
Lock& operator =(const Lock &);
int _fd;
bool _isLocked;
public:
int fd() const { return _fd; }
int size();
explicit Lock(const char *filename, int mode = O_RDONLY | O_NOCTTY);
explicit Lock(int fd);
~Lock();
void lock(bool isExclusive);
void unlock();
};
} // end namespace ns_log
|