• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / mender / 950534094

pending completion
950534094

push

gitlab-ci

kacf
chore: Add `StartsWith` and `EndsWith` generic utility functions.

Also use the latter in `states.cpp`.

Signed-off-by: Kristian Amlie <kristian.amlie@northern.tech>

1 of 1 new or added line in 1 file covered. (100.0%)

4931 of 6276 relevant lines covered (78.57%)

196.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.0
/common/events/platform/boost/events.cpp
1
// Copyright 2023 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14

15
#include <common/events.hpp>
16

17
#include <boost/asio.hpp>
18

19
namespace mender {
20
namespace common {
21
namespace events {
22

23
namespace asio = boost::asio;
24

25
void EventLoop::Run() {
358✔
26
        bool stopped = ctx_.stopped();
358✔
27
        if (stopped) {
358✔
28
                ctx_.restart();
×
29
        }
30
        ctx_.run();
358✔
31
        if (!stopped) {
325✔
32
                // For recursive invocations. If we were originally running, but we stopped and
33
                // exited this level, then keep the running state of the previous recursive level.
34
                ctx_.restart();
325✔
35
        }
36
}
325✔
37

38
void EventLoop::Stop() {
323✔
39
        ctx_.stop();
323✔
40
}
323✔
41

42
void EventLoop::Post(std::function<void()> func) {
2,393✔
43
        ctx_.post(func);
2,393✔
44
}
2,393✔
45

46
Timer::Timer(EventLoop &loop) :
630✔
47
        timer_(GetAsioIoContext(loop)) {
630✔
48
}
630✔
49

50
void Timer::Cancel() {
914✔
51
        timer_.cancel();
914✔
52
}
914✔
53

54
} // namespace events
55
} // namespace common
56
} // namespace mender
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc