example.hpp
/**
*   This will run the example
*   in multithreading style,
*   trying to broke the ThreadPool.
*/
This will run the example
in multithreading style,
trying to broke the ThreadPool.
This will run the example in multithreading style trying to broke the ThreadPool .
void
example_simulate_multithreading_access(int number_of_access_thread) {
    auto acc_thread = std::vector<std::thread>(number_of_access_thread);
    for (int i = 0; i < number_of_access_thread; i++) {
        acc_thread[i] = std::thread([] () {
            example_global_func(10);
            example_member_function(ThreadPoolTest::random(-5, 24), 1000);
        });
    }
    for (int i = 0; i < number_of_access_thread; i++) {
        acc_thread[i].join();
    }
}
void example_simulate_multithreading_access ( int number_of_access_thread ) { auto acc_thread = std :: vector < std :: thread > ( number_of_access_thread ) ; for ( int i = 0 ; i < number_of_access_thread ; i ++ ) { acc_thread [ i ] = std :: thread ( [ ] ( ) { example_global_func ( 10 ) ; example_member_function ( ThreadPoolTest :: random ( -5 , 24 ) , 1000 ) ; } ) ; } for ( int i = 0 ; i < number_of_access_thread ; i ++ ) { acc_thread [ i ] . join ( ) ; } }
This will run the example
in multithreading style,
trying to broke the ThreadPool.
This will run the example in multithreading style trying to broke the ThreadPool .