15 Apr
2012
15 Apr
'12
1:09 p.m.
To end the thread, just return from the thread function.
Ok , how do i know which thread is the one im looking for ? i cant use switch statements .!
thread::id class has comparison operators, use "if": http://www.boost.org/doc/libs/1_49_0/doc/html/thread/thread_management.html#...
and please note that i want to really get rid of the thread, i dont want to return each time it is spawned ! ( actaully returning means , get in the function , but dont do anything ! right? )
Why is it spawned each time? Thread is a "thread of execution". When you launch it in c/c++, it starts in the beginning of some function and ends when the function ends. So if you return from the thread function, this particular thread exits.