arm: cleanup dead async code

This commit is contained in:
Paul Mathieu 2023-06-07 09:59:54 +02:00
parent 83c80f15be
commit 8c25ce8d21
2 changed files with 1 additions and 89 deletions

View File

@ -165,31 +165,4 @@ void resume(AwaitableType type) {
delete stuff;
}
} // namespace async
#if 0
task<buffer> readline() {
int size = 0;
char c;
buffer buff = buffer::make(32);
// fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);
while (true) {
int n = read(0, &c, 1);
if (n < 1) {
co_await co_waitio();
continue;
}
buff.data[size++] = static_cast<std::byte>(c);
if (c == '\n') {
buff.data = buff.data.subspan(0, size);
co_return buff;
}
}
}
#endif // 0
} // namespace async

View File

@ -27,66 +27,6 @@ struct task_final_suspend {
std::coroutine_handle<> parent;
};
#if 0
template <typename T>
struct gimme {
// child interface
bool await_ready() { return false; }
void await_suspend(std::coroutine_handle<> h) {
ha = h;
waiting = true;
TRACE(tracing::TraceEvent::kAsyncGimmeWaiting);
if (parent) {
TRACE(tracing::TraceEvent::kAsyncCallParent);
parent.resume();
TRACE(tracing::TraceEvent::kAsyncCallParentDone);
}
}
T await_resume() {
waiting = false;
TRACE(tracing::TraceEvent::kAsyncGimmeResume);
return std::move(stuff);
}
// parent interface
auto feed(T&& s) {
struct awaitable {
bool await_ready() {
if (g.waiting) {
return true;
}
// TODO: handle g.ha.done()
return false;
}
void await_suspend(std::coroutine_handle<> h) {
g.parent = h;
}
void await_resume() {}
gimme<T>& g;
};
if (!waiting) {
__builtin_trap();
}
if (!ha) {
__builtin_trap();
}
stuff = s;
parent = {};
ha.resume();
return awaitable{.g = *this};
}
bool waiting = false;
std::coroutine_handle<> ha;
T stuff;
std::coroutine_handle<> parent;
};
#else
template <typename T>
struct gimme {
// child interface
@ -118,7 +58,6 @@ struct gimme {
std::coroutine_handle<> ha;
T stuff;
};
#endif
template <typename T = void>
struct task;