I'm looking for the simplest, most straightforward way to implement the following:
- The main program instantiates worker threads to do a task.
- Only
ntasks can be running at once. - When
nis reached, no more workers are started until the count of running threads drops back belown.