MCPcopy Create free account
hub / github.com/boostorg/cobalt / ~awaitable_spsc_queue

Method ~awaitable_spsc_queue

example/spsc.cpp:25–32  ·  view source on GitHub ↗

if the queue gets destroyed, destroying the awaiters is all we can do.

Source from the content-addressed store, hash-verified

23
24 // if the queue gets destroyed, destroying the awaiters is all we can do.
25 ~awaitable_spsc_queue()
26 {
27 if (auto r = reader.load(); r != nullptr)
28 std::coroutine_handle<void>::from_address(r).destroy();
29
30 if (auto w = writer.load(); w != nullptr)
31 std::coroutine_handle<void>::from_address(w).destroy();
32 }
33 // to avoid locks, put the coroutine handles into atomics.
34 std::atomic<void*> reader{nullptr}, writer{nullptr};
35

Callers

nothing calls this directly

Calls 1

destroyMethod · 0.45

Tested by

no test coverage detected