Skip to content

WorkerThreadPool.add_group_task freeze when use all threads with high_priority #107674

Open
@Ohan17

Description

@Ohan17

Tested versions

Reproducible in v4.4.1.stable.official [49a5bc7]

System information

Godot v4.4.1.stable - Windows 10 (build 19044) - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3050 Laptop GPU (NVIDIA; 32.0.15.7652) - 11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz (12 threads)

Issue description

Calling WorkerThreadPool.add_group_task with tasks_needed = -1 and high_priority = true cause the app to freezes until all group tasks are finished at the same time. WorkerThreadPool should not block the main thread even when all its threads are busy.

extends Node2D

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	WorkerThreadPool.add_group_task(do, 100, -1, false) # doesn't freeze, call a few 'do' task a time
	#WorkerThreadPool.add_group_task(do, 100, -1, true) # freezes

func do(idx: int) -> void:
	for i in 10000000:
		pass
	print(idx)

Steps to reproduce

Run the small code snipet above.

Minimal reproduction project (MRP)

See above.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    For team assessment

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions