multithreading - How to create iterative boost threads? -


i working boost threads library in c++ , want create different threads process buckets of data. firstly, load data smaller buckets (100 elements each) , assign each bucket thread. available threads four, avoid create new threads until there free new thread. pseudocode follows:

while(pool1->has_next()){      int tmp = pool->get_next();     pool2->pushback(tmp);      if(pool2->size()%100==0){          while(working_threads>=4){             wait();         }         new thread (proc(pool2));     }     pool2->clear(); } 

how can done boost threads?

sounds want thread pool or thread group, have example of on github:

git@github.com:cdesjardins/jobbatcher.git


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -