Skip to content

Commit 0f34dee

Browse files
committed
ChunkLock: Fix constructor not locking and add adopt/defer constructors
1 parent 1a790e9 commit 0f34dee

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

include/CommonLib/ChunkLock.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ namespace tsom
2121

2222
public:
2323
ChunkLock(ChunkType chunk);
24+
ChunkLock(ChunkType chunk, std::adopt_lock_t);
25+
ChunkLock(ChunkType chunk, std::defer_lock_t);
2426
ChunkLock(const ChunkLock&) = delete;
2527
ChunkLock(ChunkLock&& chunkLock) noexcept;
2628
~ChunkLock();

include/CommonLib/ChunkLock.inl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ namespace tsom
99
template<bool Write>
1010
ChunkLock<Write>::ChunkLock(ChunkType chunk) :
1111
m_isLocked(false)
12+
{
13+
Lock();
14+
}
15+
16+
template<bool Write>
17+
ChunkLock<Write>::ChunkLock(ChunkType chunk, std::adopt_lock_t) :
18+
m_isLocked(true)
19+
{
20+
}
21+
22+
template<bool Write>
23+
ChunkLock<Write>::ChunkLock(ChunkType chunk, std::defer_lock_t) :
24+
m_isLocked(false)
1225
{
1326
}
1427

0 commit comments

Comments
 (0)