I know an answer has been accepted, if you need this right now, and you can't be bothered to write your own thread pool, you could try using boost asio io_service with a concurrency hint (i.e. how many threads it should run) and then post() stuff to this io_service... just an idea..
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…