Skip to content

Commit f92f4b3

Browse files
committed
Docs
1 parent a67d765 commit f92f4b3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crates/rspack_core/src/utils/task_loop.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub trait Task<Ctx>: Debug + Send + Any + AsAny {
5454
struct TaskLoop<Ctx> {
5555
/// Main tasks run sequentially in the queue
5656
main_task_queue: VecDeque<Box<dyn Task<Ctx>>>,
57-
/// The count of the running background tasks which run immediately in tokio thread workers when they are returnt
57+
/// The count of the running background tasks which run immediately in tokio thread workers when they are returned
5858
background_task_count: u32,
5959
/// Mark whether the task loop has been returned.
6060
/// The async task should not call `tx.send` after this mark to true
@@ -88,10 +88,13 @@ impl<Ctx: 'static> TaskLoop<Ctx> {
8888

8989
loop {
9090
let task = self.main_task_queue.pop_front();
91+
92+
// If there's no main tasks and background tasksm
9193
if task.is_none() && self.background_task_count == 0 {
9294
return Ok(());
9395
}
9496

97+
// Background tasks are launched as soon as they are returned, so we don't put them into the queue.
9598
if let Some(task) = task {
9699
debug_assert!(matches!(task.get_task_type(), TaskType::Main));
97100
self.handle_task_result(task.main_run(ctx).await)?;

0 commit comments

Comments
 (0)