Closed giovinazzo-kevin closed 2 years ago
It is worth mentioning that although builtins should probably not invoke async code, user-written builtins could.
A new type of "thread context" should be created such that whenever some code needs to await something, it can do that properly while blocking the calling thread.
A new type of "thread context" should be created such that whenever some code needs to await something, it can do that properly while blocking the calling thread.
Calling IAsyncEnumerable.ToEnumerable()
in pull_data
seems to do the trick.
AsyncEnumerables are very expensive. They were initially introduced for data sinks and sources, but seeing as those are a fringe feature that is not standard Prolog, they don't warrant a massive penalty to performance. Those will need to be implemented some other way, such as by blocking the calling thread.