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

jbaldwin / libcoro / 13091862473

01 Feb 2025 07:46PM UTC coverage: 85.245%. First build
13091862473

Pull #295

github

web-flow
Merge a7262ad2b into cd4405c90
Pull Request #295: Add executor.schedule(coro::task<void>) -> bool

21 of 23 new or added lines in 5 files covered. (91.3%)

1375 of 1613 relevant lines covered (85.24%)

4326704.25 hits per line

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

58.33
/src/detail/task_self_deleting.cpp
1
#include "coro/detail/task_self_deleting.hpp"
2

3
#include <utility>
4

5
namespace coro::detail
6
{
7

8
promise_self_deleting::promise_self_deleting()
400,508✔
9
{
10
}
400,508✔
11

12
promise_self_deleting::~promise_self_deleting()
400,507✔
13
{
14
}
400,507✔
15

16
promise_self_deleting::promise_self_deleting(promise_self_deleting&& other)
×
NEW
17
    : m_executor_size(std::exchange(other.m_executor_size, nullptr))
×
18
{
19
}
×
20

21
auto promise_self_deleting::operator=(promise_self_deleting&& other) -> promise_self_deleting&
×
22
{
23
    if (std::addressof(other) != nullptr)
×
24
    {
NEW
25
        m_executor_size = std::exchange(other.m_executor_size, nullptr);
×
26
    }
27

28
    return *this;
×
29
}
30

31
auto promise_self_deleting::get_return_object() -> task_self_deleting
400,508✔
32
{
33
    return task_self_deleting{*this};
400,508✔
34
}
35

36
auto promise_self_deleting::initial_suspend() -> std::suspend_always
400,507✔
37
{
38
    return std::suspend_always{};
400,507✔
39
}
40

41
auto promise_self_deleting::final_suspend() noexcept -> std::suspend_never
400,508✔
42
{
43
    // Notify the task_container<executor_t> that this coroutine has completed.
44
    if (m_executor_size != nullptr)
400,508✔
45
    {
46
        m_executor_size->fetch_sub(1, std::memory_order::release);
400,508✔
47
    }
48

49
    // By not suspending this lets the coroutine destroy itself.
50
    return std::suspend_never{};
400,508✔
51
}
52

53
auto promise_self_deleting::return_void() noexcept -> void
400,508✔
54
{
55
    // no-op
56
}
400,508✔
57

58
auto promise_self_deleting::unhandled_exception() -> void
×
59
{
60
    // The user cannot access the promise anyways, ignore the exception.
61
}
×
62

63
auto promise_self_deleting::executor_size(std::atomic<std::size_t>& executor_size) -> void
400,508✔
64
{
65
    m_executor_size = &executor_size;
400,508✔
66
}
400,508✔
67

68
task_self_deleting::task_self_deleting(promise_self_deleting& promise) : m_promise(&promise)
400,508✔
69
{
70
}
400,508✔
71

72
task_self_deleting::~task_self_deleting()
400,507✔
73
{
74
}
400,507✔
75

76
task_self_deleting::task_self_deleting(task_self_deleting&& other) : m_promise(other.m_promise)
×
77
{
78
}
×
79

80
auto task_self_deleting::operator=(task_self_deleting&& other) -> task_self_deleting&
×
81
{
82
    if (std::addressof(other) != this)
×
83
    {
84
        m_promise = other.m_promise;
×
85
    }
86

87
    return *this;
×
88
}
89

90
} // namespace coro::detail
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

© 2026 Coveralls, Inc