Subject: Re: [boost] Adding an option to set the name of a boost::thread
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2012-11-07 05:19:55
Vicente Botet wrote
> Le 06/11/12 19:50,
> a Ã©crit :
>> Has any thought been given to allowing a name to be set on a
>> boost::thread, such that (if the underlying implementation supports it)
>> that name would show up in things like top and ps?
>> In Linux, you can name a thread via the prctl() call and it will show up
>> in top - dandy for debugging which of the bazillion threads in my app has
>> decided to suck up all the CPU.
>> I don't know if Windows supports such a call, and IMHO it would be
>> acceptable if the call did nothing in such a case.
>> Ideally, I'd want to see it as a property, something like:
>> void boost::thread::set_name(std::string name)
>> std::string boost::thread::get_name() const;
> yes this should be useful if there is a portable way to implement it.
> Please could you create a Trac ticket? I will appreciate a patch that
> works on linux for you.
I have checked prctl and it seems that this set the name of the current
thread, could you confirm?
In this case it will be better 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.
-- View this message in context: http://boost.2283326.n4.nabble.com/Adding-an-option-to-set-the-name-of-a-boost-thread-tp4638283p4638308.html Sent from the Boost - Dev mailing list archive at Nabble.com.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk