Threadpool implementation in C++11
I don't see why this should have a hypothetical name:


void foo() {
    printf("hello by %p\n", ::std::this_thread::get_id());
    sleep(1); 
}



If this is meant as a test function, then name it as such.  As obvious as the functionality may be, there's still need for such names in an otherwise serious program.

Also, you can use std::this_thread::sleep_for, which is as of C++11:

std::this_thread::sleep_for(std::chrono::seconds(1));


If you also have C++14, use a literal instead:

std::this_thread::sleep_for(1s);


(You'll also need &lt;chrono&gt; for all of this.)