Core: make sure there are enough threads available during generate_output to prevent deadlocks if event waiting is used