1
0
mirror of https://github.com/PerMalmberg/libcron.git synced 2025-10-18 05:45:20 -05:00

Feature/add executed on time check (#7)

* Initial commit on executed on time feature. A task was executed on time if the function call happened within one second since it expired.

* Adding tests, fixing some errors.

* Using recursirve mutex to allowing to call safely call was_executed_on_time in an Mt-environment

* Changing from boolean expression to get_delay, being even more flexibel

* Cleanup

* Adding dedicated TaskContext

* Changing to Interface-Class Approach

* Renaming to TaskInformation, making it pure virtual

* Removing unnecessary Proxy-Class

* Cleaning up

* Passing a const reference instead of a pointer to avoid nullptr checks in the callback

* Cleaning up add_schedule.

* Adding TaskInformation API to readme.

Co-authored-by: Heinz-Peter Liechtenecker <h.liechtenecker@fh-kaernten.at>
This commit is contained in:
Heinz-Peter Liechtenecker
2020-09-10 19:03:50 +02:00
committed by GitHub
parent 76da315c13
commit 7ef39558a1
9 changed files with 113 additions and 33 deletions

View File

@@ -23,13 +23,13 @@ void test(const char* const random_schedule, bool expect_failure = false)
if(expect_failure)
{
// Parsing of random might succeed, but it yields an invalid schedule.
auto r = std::get<0>(res) && cron.add_schedule("validate schedule", schedule, []() {});
auto r = std::get<0>(res) && cron.add_schedule("validate schedule", schedule, [](auto&) {});
REQUIRE_FALSE(r);
}
else
{
REQUIRE(std::get<0>(res));
REQUIRE(cron.add_schedule("validate schedule", schedule, []() {}));
REQUIRE(cron.add_schedule("validate schedule", schedule, [](auto&) {}));
}
}