
Le 07/11/12 18:22, david.hagood@gmail.com a écrit :
This is exactly what I meant when I said "to associate the setting of the name attribute to the thread_attributes class so that the implementation can set it at the start of the thread. "
So that the setting can not be of the thread class as the thread will be already started.
First, a silly question: where is thread::attributes documented? I looked at the boost.org pages on the thread library, but never found a good, concise reference for what the members of thread::attributes are.
Here is the reference documentation http://www.boost.org/doc/libs/1_52_0/doc/html/thread/thread_management.html#...
Second: Just having a free function under this_thread to set the name in a portable fashion would be a start - at least prctl and the GLib functions can be called at any time to set the thread name. If there were a void this_thread::set_name(std::string name) that would meet most of my needs.
This is an plausible alternative, but I guess that others will want to set the name at creation time, isn't it?
(indeed - in times past I've used something like that to help debugging - change the "name" of the thread to indicate state as the thread operates, so you can easily see where a thread is in its operation just by using top or ps).
Good point. This could be useful as well. As already I said, in a preceding post, a patch is welcome ;-) Best, Vicente