diff options
author | Mike Buland <mbuland@penny-arcade.com> | 2018-05-25 14:17:20 -0700 |
---|---|---|
committer | Mike Buland <mbuland@penny-arcade.com> | 2018-05-25 14:17:20 -0700 |
commit | 9bcbc8f919fc1c779d3b9c649dcbe3606fdbed32 (patch) | |
tree | 3f3983791f54b0b6112f7a9a887739c52d0504ea /src/stable/file.h | |
parent | f31d308827f848fdcd8ad61b89513f3c20b34e20 (diff) | |
download | libbu++-9bcbc8f919fc1c779d3b9c649dcbe3606fdbed32.tar.gz libbu++-9bcbc8f919fc1c779d3b9c649dcbe3606fdbed32.tar.bz2 libbu++-9bcbc8f919fc1c779d3b9c649dcbe3606fdbed32.tar.xz libbu++-9bcbc8f919fc1c779d3b9c649dcbe3606fdbed32.zip |
Added locking support to Bu::File.
Diffstat (limited to 'src/stable/file.h')
-rw-r--r-- | src/stable/file.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/stable/file.h b/src/stable/file.h index e3497d3..6e05dc7 100644 --- a/src/stable/file.h +++ b/src/stable/file.h | |||
@@ -56,6 +56,25 @@ namespace Bu | |||
56 | virtual bool isBlocking(); | 56 | virtual bool isBlocking(); |
57 | virtual void setBlocking( bool bBlocking=true ); | 57 | virtual void setBlocking( bool bBlocking=true ); |
58 | 58 | ||
59 | /** | ||
60 | * Tells you if advisory locks are supported. | ||
61 | */ | ||
62 | bool canLock() const; | ||
63 | |||
64 | /** | ||
65 | * Acquires an advisory lock on the file. On posix/linux this is done | ||
66 | * via flock. | ||
67 | *@param bExclusive Set to true to acquire an exclusive lock (i.e. a | ||
68 | * write lock). If this is false then a shared lock (i.e. read lock) is | ||
69 | * acquired. A file cannot have both an exclusive and shared lock. | ||
70 | */ | ||
71 | void lock( bool bExclusive=true ); | ||
72 | |||
73 | /** | ||
74 | * Release the held advisory lock. | ||
75 | */ | ||
76 | void unlock(); | ||
77 | |||
59 | enum { | 78 | enum { |
60 | // Flags | 79 | // Flags |
61 | Read = 0x01, ///< Open file for reading | 80 | Read = 0x01, ///< Open file for reading |