does a thread of execution always have an id ? i mean does a threads id gets deleted when we make a thread detached ?
It's not that thread id "gets deleted", but a detached thread object releases its internal thread info and thus it cannot return you thread id or any other thread-related info.
im asking this because , if i detach a thread , and thus there is no valid boost::thread object available , how can i access a thread Id using boost::this_thread::get_id() ?
This is because the facilities, which reside inside this_thread namespace, are available to you even if there's no thread object associated with this thread. You can even launch a thread using non-boost api (like _beginthread), and still be able to use this_thread functions (except for interruption).
the detached thread is not a boost::thread object any more right? then whats the point of comparing the id of this_thread ?! will it make sense at all ?
Yes, if you took thread.id(), stored it somewhere, called thread.detach(), you can later compare this id against this_thread::get_id().