ot-br-posix icon indicating copy to clipboard operation
ot-br-posix copied to clipboard

[common] simplify mainloop processing

Open wgtdkp opened this issue 3 years ago • 1 comments

This commit simplifies mainloop process by providing RunMainloop() which encapsulates updating and processing mainloop processores. We also provide BreakMainloop() which can breaks the blocking RunMainloop() method even from another thread.

This commit also enhances mainloop breaking logic to ensure that it can always be stopped immediately by always adding a TaskRunner to the Mainloop processors list.

wgtdkp avatar Nov 24 '21 15:11 wgtdkp

Codecov Report

Merging #1110 (80551fa) into main (e5f9183) will increase coverage by 0.12%. The diff coverage is 98.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1110      +/-   ##
==========================================
+ Coverage   56.53%   56.65%   +0.12%     
==========================================
  Files          85       82       -3     
  Lines        6352     6315      -37     
==========================================
- Hits         3591     3578      -13     
+ Misses       2761     2737      -24     
Impacted Files Coverage Δ
src/common/task_runner.cpp 70.90% <ø> (+21.78%) :arrow_up:
tests/unit/test_task_runner.cpp 98.30% <97.18%> (-1.70%) :arrow_down:
src/agent/main.cpp 70.52% <100.00%> (-1.59%) :arrow_down:
src/common/mainloop_manager.cpp 100.00% <100.00%> (ø)
src/common/mainloop_manager.hpp 100.00% <100.00%> (ø)
tests/mdns/main.cpp 97.95% <100.00%> (-0.15%) :arrow_down:
src/mdns/mdns_avahi.cpp 41.91% <0.00%> (ø)
src/mdns/mdns_mdnssd.cpp 22.14% <0.00%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e5f9183...80551fa. Read the comment docs.

codecov[bot] avatar Nov 24 '21 15:11 codecov[bot]

This PR is obsoleted since the mainloop is already encapsulated in method Application::Run().

wgtdkp avatar Feb 15 '23 08:02 wgtdkp