(Moved from #mod-dev-1)
I'm trying to use this pure Java coroutine implementation to add concurrecy to a custom pathfinder, but all it does is it freezes the server thread, anyone encountered this problem and (possibly) solved it?
How I'm running the coroutine :
CoroutineScope.launch(scope -> this.findPathCoroutine.runAsync(scope,new Pair<>(navigator,request)).await());
The coroutine itself :
private final Coroutine<Pair<PathNodeNavigator,PathRequest>,Void> findPathCoroutine = first(
apply((pair) -> {
pair.getLeft().findPath(pair.getRight(),this::finishedProcessing);
return null;
})
);
Reason why I'm not using threads is because they are kinda slow for some reason, and reason why I'm not using virtual threads is because the mod is for 1.20.1 and I'm using java 17 and I don't want to lock my mod to a specific Java version.