
15 Apr
2012
15 Apr
'12
12:45 p.m.
i have been trying to selectively dispose a thread among some other threads , but so far i wasnt successful in finding a way to do it . suppose i have a simple function which identifies any threads which gets into it and if a specific one is located ,it is disposed . simply sth like this :
#include
#include <iostream> #include using namespace std; boost::thread threadarray[3]; int t(int x) { boost::id id(); switch(boost::this_thread::get_id()) { case threadarray[0].get_id(): cout<<"thread 1"; break; case threadarray[1].get_id(): DISPOSE THIS THREAD or CHANGE OWNERSHITP, OR GET ANOTHER JOB TO IT , OR CHECK IF IT WAS SUCCESSFUL OR NOT
To end the thread, just return from the thread function.