but there is a problem , the first thread doesnt print anything on the cosole ! while the others do! i even used mutex , but seems its not the case . any idea?
Your code is not thread-safe. See my comments below.
int t(int x) { if(threadarray[0].get_id() == boost::this_thread::get_id())
Here and below in this thread function you access "threadarray" without protecting it with mutex. <...>
int main() { boost::thread t1(t,5), t2(t,6),t3(t,7);
threadarray[0] = t1.move(); threadarray[1] = t2.move(); threadarray[2] = t3.move();
Here you write to "threadarray" without protecting it with a mutex. Besides, some (or all) the threads that you launched above might have been already executed their thread functions and exited - before you have a chance to store their objects in "threadarray".