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

jbaldwin / libcoro / 13082547569

31 Jan 2025 11:33PM UTC coverage: 85.847%. First build
13082547569

Pull #295

github

web-flow
Merge aca6aad9e 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%)

1383 of 1611 relevant lines covered (85.85%)

4332848.74 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,506✔
9
{
10
}
400,506✔
11

12
promise_self_deleting::~promise_self_deleting()
400,508✔
13
{
14
}
400,508✔
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,506✔
32
{
33
    return task_self_deleting{*this};
400,506✔
34
}
35

36
auto promise_self_deleting::initial_suspend() -> std::suspend_always
400,506✔
37
{
38
    return std::suspend_always{};
400,506✔
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,506✔
64
{
65
    m_executor_size = &executor_size;
400,506✔
66
}
400,506✔
67

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

72
task_self_deleting::~task_self_deleting()
400,504✔
73
{
74
}
400,504✔
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