Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <Windows.h>
- #include <boost\thread.hpp>
- boost::thread my_boost_th;
- void multiprocesso(int id) {
- static int rep=-1;
- boost::this_thread::sleep(boost::get_system_time()+boost::posix_time::milliseconds(1000));
- printf("id - %d",id);
- rep++;
- if(!rep) {
- multiprocesso(id);
- }
- }
- void interrompe() {
- boost::this_thread::sleep(boost::get_system_time()+boost::posix_time::milliseconds(1300));
- my_boost_th.interrupt();
- }
- int main()
- {
- my_boost_th=boost::thread(multiprocesso,10);
- boost::thread interronper(interrompe);
- Sleep(5000);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement