diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2019-11-20 17:06:45 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2019-11-20 17:06:45 +0300 |
commit | 553f85c066250eb3dffa8b3b6990a0353d7a7edf (patch) | |
tree | 6fb301480c0964467393aff6e5a923a6a004122a /programs | |
parent | f82a20af4b27de3561d02e07965aaa727eb323de (diff) |
Fix build of programs.
Diffstat (limited to 'programs')
-rw-r--r-- | programs/illegal-codepoints/main.cpp | 4 | ||||
-rw-r--r-- | programs/key-value-store/include/key_value_store.hpp | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/programs/illegal-codepoints/main.cpp b/programs/illegal-codepoints/main.cpp index a86d0c4c..9babcf16 100644 --- a/programs/illegal-codepoints/main.cpp +++ b/programs/illegal-codepoints/main.cpp @@ -6100,6 +6100,10 @@ az a�z az #include <iostream> #include <vector> +#ifdef _WIN32 +#include <codecvt> +#endif + namespace llfio = LLFIO_V2_NAMESPACE; int main() diff --git a/programs/key-value-store/include/key_value_store.hpp b/programs/key-value-store/include/key_value_store.hpp index 8ec30836..ac8407c6 100644 --- a/programs/key-value-store/include/key_value_store.hpp +++ b/programs/key-value-store/include/key_value_store.hpp @@ -204,7 +204,7 @@ namespace key_value_store if(mode == llfio::file_handle::mode::write && !_mysmallfile.is_valid()) { // Try to claim this small file - auto smallfileclaimed = fh.value().try_lock(_indexinuseoffset, 1, true); + auto smallfileclaimed = fh.value().lock_file_range(_indexinuseoffset, 1, llfio::file_handle::lock_kind::exclusive, std::chrono::seconds(0)); if(smallfileclaimed) { _mysmallfile = llfio::file_handle::file(dir, name, llfio::file_handle::mode::write, llfio::file_handle::creation::open_existing, caching).value(); @@ -272,7 +272,7 @@ namespace key_value_store if(mode == llfio::file_handle::mode::write) { // Try an exclusive lock on inuse byte of the index file - auto indexinuse = _indexfile.try_lock(_indexinuseoffset, 1, true); + auto indexinuse = _indexfile.lock_file_range(_indexinuseoffset, 1, llfio::file_handle::lock_kind::exclusive, std::chrono::seconds(0)); if(indexinuse.has_value()) { // I am the first entrant into this data store @@ -311,7 +311,7 @@ namespace key_value_store } } // Take a shared lock, blocking if someone is still setting things up - _indexfileguard = _indexfile.lock(_indexinuseoffset, 1, false).value(); + _indexfileguard = _indexfile.lock_file_range(_indexinuseoffset, 1, llfio::file_handle::lock_kind::shared).value(); { llfio::byte buffer[8]; _indexfile.read(0, {{buffer, 8}}).value(); @@ -346,7 +346,7 @@ namespace key_value_store _mysmallfile.close().value(); // Try to lock the index exclusively _indexfileguard.unlock(); - auto indexfileguard = _indexfile.try_lock(_indexinuseoffset, 1, true); + auto indexfileguard = _indexfile.lock_file_range(_indexinuseoffset, 1, llfio::file_handle::lock_kind::exclusive, std::chrono::seconds(0)); if(indexfileguard) { // I am the last user |