build: tasks: make thread protection scale better

Signed-off-by: Bart Kuivenhoven <bemkuivenhoven@gmail.com>