Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/llfio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2021-05-25 13:49:37 +0300
committerNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2021-05-25 13:49:37 +0300
commit1380d0cbac91821488a1f0a494cb220ae864a252 (patch)
tree4d8c5cae473e45eda41986c17a49eb054f1a54f3 /include
parenta93b8521afb5d858f423de7accdc6d9d4504e7cb (diff)
Fix bug where native Linux dynamic_thread_pool_group would schedule delayed work items inverted to correctness.
Diffstat (limited to 'include')
-rw-r--r--include/llfio/revision.hpp6
-rw-r--r--include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp27
-rw-r--r--include/llfio/v2.0/detail/impl/reduce.ipp6
3 files changed, 26 insertions, 13 deletions
diff --git a/include/llfio/revision.hpp b/include/llfio/revision.hpp
index 8d06f55a..424376d1 100644
--- a/include/llfio/revision.hpp
+++ b/include/llfio/revision.hpp
@@ -1,4 +1,4 @@
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
-#define LLFIO_PREVIOUS_COMMIT_REF b1a36308e99c5477fc3791de6f9fff993099c69f
-#define LLFIO_PREVIOUS_COMMIT_DATE "2021-04-29 16:33:49 +00:00"
-#define LLFIO_PREVIOUS_COMMIT_UNIQUE b1a36308
+#define LLFIO_PREVIOUS_COMMIT_REF a93b8521afb5d858f423de7accdc6d9d4504e7cb
+#define LLFIO_PREVIOUS_COMMIT_DATE "2021-05-11 18:16:38 +00:00"
+#define LLFIO_PREVIOUS_COMMIT_UNIQUE a93b8521
diff --git a/include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp b/include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp
index 08e6762e..4192306c 100644
--- a/include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp
+++ b/include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp
@@ -458,7 +458,7 @@ namespace detail
bool done = false;
for(dynamic_thread_pool_group::work_item *p = nullptr, *n = next_timer_relative.front; n != nullptr; p = n, n = n->_next_scheduled)
{
- if(n->_timepoint1 <= i->_timepoint1)
+ if(n->_timepoint1 > i->_timepoint1)
{
if(p == nullptr)
{
@@ -480,6 +480,21 @@ namespace detail
i->_next_scheduled = nullptr;
next_timer_relative.back = i;
}
+#if 0
+ {
+ auto now = std::chrono::steady_clock::now();
+ std::cout << "\n";
+ for(dynamic_thread_pool_group::work_item *p = nullptr, *n = next_timer_relative.front; n != nullptr; p = n, n = n->_next_scheduled)
+ {
+ if(p != nullptr)
+ {
+ assert(n->_timepoint1 >= p->_timepoint1);
+ }
+ std::cout << "\nRelative timer: " << std::chrono::duration_cast<std::chrono::milliseconds>(n->_timepoint1 - now).count();
+ }
+ std::cout << std::endl;
+ }
+#endif
}
next_timer_relative.lock.unlock();
}
@@ -496,7 +511,7 @@ namespace detail
bool done = false;
for(dynamic_thread_pool_group::work_item *p = nullptr, *n = next_timer_absolute.front; n != nullptr; p = n, n = n->_next_scheduled)
{
- if(n->_timepoint2 <= i->_timepoint2)
+ if(n->_timepoint2 > i->_timepoint2)
{
if(p == nullptr)
{
@@ -1151,8 +1166,12 @@ namespace detail
{
if(d.steady)
{
- workitem->_timepoint1 = std::chrono::steady_clock::now() + std::chrono::nanoseconds(d.nsecs);
- workitem->_timepoint2 = {};
+ std::chrono::microseconds diff(d.nsecs / 1000);
+ if(diff > std::chrono::microseconds(0))
+ {
+ workitem->_timepoint1 = std::chrono::steady_clock::now() + diff;
+ workitem->_timepoint2 = {};
+ }
}
else
{
diff --git a/include/llfio/v2.0/detail/impl/reduce.ipp b/include/llfio/v2.0/detail/impl/reduce.ipp
index 5ce27e3b..1ed837cd 100644
--- a/include/llfio/v2.0/detail/impl/reduce.ipp
+++ b/include/llfio/v2.0/detail/impl/reduce.ipp
@@ -64,8 +64,6 @@ namespace algorithm
0x20 /*FILE_SYNCHRONOUS_IO_NONALERT*/ | 0x00200000 /*FILE_OPEN_REPARSE_POINT*/ | 0x00001000 /*FILE_DELETE_ON_CLOSE*/ | 0x040 /*FILE_NON_DIRECTORY_FILE*/;
const DWORD deletedir_ntflags =
0x20 /*FILE_SYNCHRONOUS_IO_NONALERT*/ | 0x00200000 /*FILE_OPEN_REPARSE_POINT*/ | 0x00001000 /*FILE_DELETE_ON_CLOSE*/ | 0x01 /*FILE_DIRECTORY_FILE*/;
- const DWORD renamefile_ntflags = 0x20 /*FILE_SYNCHRONOUS_IO_NONALERT*/ | 0x00200000 /*FILE_OPEN_REPARSE_POINT*/ | 0x040 /*FILE_NON_DIRECTORY_FILE*/;
- const DWORD renamedir_ntflags = 0x20 /*FILE_SYNCHRONOUS_IO_NONALERT*/ | 0x00200000 /*FILE_OPEN_REPARSE_POINT*/ | 0x01 /*FILE_DIRECTORY_FILE*/;
IO_STATUS_BLOCK isb = make_iostatus();
path_view::c_str<> zpath(leafname, path_view::zero_terminated);
UNICODE_STRING _path{};
@@ -172,10 +170,6 @@ namespace algorithm
using namespace windows_nt_kernel;
const DWORD access = SYNCHRONIZE | DELETE;
const DWORD fileshare = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
- const DWORD deletefile_ntflags =
- 0x20 /*FILE_SYNCHRONOUS_IO_NONALERT*/ | 0x00200000 /*FILE_OPEN_REPARSE_POINT*/ | 0x00001000 /*FILE_DELETE_ON_CLOSE*/ | 0x040 /*FILE_NON_DIRECTORY_FILE*/;
- const DWORD deletedir_ntflags =
- 0x20 /*FILE_SYNCHRONOUS_IO_NONALERT*/ | 0x00200000 /*FILE_OPEN_REPARSE_POINT*/ | 0x00001000 /*FILE_DELETE_ON_CLOSE*/ | 0x01 /*FILE_DIRECTORY_FILE*/;
const DWORD renamefile_ntflags = 0x20 /*FILE_SYNCHRONOUS_IO_NONALERT*/ | 0x00200000 /*FILE_OPEN_REPARSE_POINT*/ | 0x040 /*FILE_NON_DIRECTORY_FILE*/;
const DWORD renamedir_ntflags = 0x20 /*FILE_SYNCHRONOUS_IO_NONALERT*/ | 0x00200000 /*FILE_OPEN_REPARSE_POINT*/ | 0x01 /*FILE_DIRECTORY_FILE*/;
IO_STATUS_BLOCK isb = make_iostatus();