diff --git a/tests/vault/gear/work-force-test.cpp b/tests/vault/gear/work-force-test.cpp index d5bf80e55..c7f7d159a 100644 --- a/tests/vault/gear/work-force-test.cpp +++ b/tests/vault/gear/work-force-test.cpp @@ -28,7 +28,8 @@ #include "lib/test/run.hpp" #include "vault/gear/work-force.hpp" //#include "lib/time/timevalue.hpp" -#include "lib/format-cout.hpp" ///////////////////////////////WIP +//#include "lib/format-cout.hpp" ///////////////////////////////WIP +#include "lib/test/diagnostic-output.hpp" ///////////////////////////////WIP //#include "lib/util.hpp" //#include @@ -150,12 +151,27 @@ namespace test { - /** @test TODO - * @todo WIP 9/23 ⟶ define ⟶ implement + /** @test can cause a worker to terminate by return-value from the work-functor */ void verify_workerHalt() { + atomic check{0}; + atomic control{activity::PASS}; + WorkForce wof{setup ([&]{ ++check; return activity::Proc(control); })}; + + wof.incScale(); + sleep_for(1ms); + + uint invocations = check; + CHECK (0 < invocations); + + control = activity::HALT; + sleep_for(1ms); + + invocations = check; + sleep_for(10ms); + CHECK (invocations == check); } @@ -234,12 +250,31 @@ namespace test { - /** @test TODO - * @todo WIP 9/23 ⟶ define ⟶ implement + /** @test dynamically determine count of currently active workers. */ void verify_countActive() { + atomic check{0}; + WorkForce wof{setup ([&]{ + ++check; + if (check == 100'000 or check == 100'110) + return activity::HALT; + else + return activity::PASS; + })}; + + CHECK (0 == wof.size()); + + wof.incScale(); + wof.incScale(); + wof.incScale(); + sleep_for(10us); // this may be fragile; must be sufficiently short + + CHECK (3 == wof.size()); + + sleep_for(50ms); + CHECK (1 == wof.size()); } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index ff784a104..aab11cec5 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -80041,8 +80041,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -80069,8 +80069,12 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + + + + +