c++ - boost thread_group with callback -
i write boost::thread_group. assuming understood correctly callback in thread apply in program.
i found following example: (thread_group out callback)
boost::thread_group group; (int = 0; < 15; ++i) group.create_thread(afunctiontoexecute); group.join_all();
if change callback, adding &
before afunctiontoexecute
?
i thought using callback following case: assuming have 2 cores , for-loop 0 99 (100 elements). instead of open 100 threads , open 2 thread (the number of cores in example) , after each thread finish computation correct variable, send done , wait order run again until 100 elements computed.
does know example or few example combine creating this?
since have not experience in threading, know way of applying group_threads "right" way?
reagrds
Comments
Post a Comment