while (threads->list()<$threadsmax) { sleep(1); # or threads->yield; but I'm not sure what happens if you call this in the main thread } print ".";