Add support for waking up only a given amount of threads