bevyengine / bevyengine/web-task

Tasks are still running on main thread

Open
#4 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
11
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Hello, I tried creating computationally intensive tasks on wasm web, on separate threads using:
```
use std::thread;
use async_task::Task;
use bevy::tasks::futures::{check_ready, now_or_never};
use web_task::{spawn};

let task: Task> = spawn(async move {
let current_thread = thread::current();
info!(
"Pathfinding is running on thread: name={:?}, id={:?}",
current_thread.name(),
current_thread.id()
);
let guard = obs_clone.read();
if let Ok(obstacles) = guard.as_ref() {
compute_path_towards(&*obstacles, pos, &target_clone, CELL_SIZE)
} else {
None
}
});
```
but it keeps printing "main" thread. I was thinking the purpose of this library is to specifically that right? Am I doing it wrong?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.