You only launch *two* tasks.   They keep going back to the
queue to get new work when they finished their current item.

---

Perhaps something like this then:

    while ( !jobs.empty() )
    {
        if ( thread_count < cores )
        {
            boost::thread t(boost::bind(&worker, jobs.front()));
            jobs.pop();
            t.join();
       }
    }

What is the correct way to determine the number of running/busy threads (thread_count)?


Hotmail: Powerful Free email with security by Microsoft. Get it now.