Skip to content

Instantly share code, notes, and snippets.

@yanok
Created September 25, 2024 14:30
Show Gist options
  • Save yanok/b3c3dcb0a0b6ae9209e3efd977002898 to your computer and use it in GitHub Desktop.
Save yanok/b3c3dcb0a0b6ae9209e3efd977002898 to your computer and use it in GitHub Desktop.
import std;
struct notrace {}
struct string_tracetail {
string value;
alias value this;
}
class ReactorFiber{
string_tracetail funcName;
@notrace setCallback(alias F)() {
funcName = fullyQualifiedName!F;
}
}
struct FiberHandle {
}
struct Reactor {
ReactorFiber allocFiber() {
return new ReactorFiber;
}
FiberHandle spawnFiber(alias F)() {
auto fib = allocFiber;
fib.setCallback!F;
return FiberHandle();
}
}
Reactor theReactor;
void closure(void delegate() ) {
}
unittest
{
closure({
static f() {}
theReactor.spawnFiber!f;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment