I don't believe there is a single implementation which will work on all
POSIX-compliant systems, but it looks like we're close enough to de-facto
standardization that we can get something which will work on all the major
platforms.
It's essentially looking at:
Which gives you code something like this:
https://github.com/ethereum/libweb3core/blob/develop/libdevcore/Log.cpp#L176
And the Windows equivalent:
http://stackoverflow.com/questions/905876/how-to-set-name-to-a-win32-thread
Thanks, Vincente for setting up the Github issue tracker, and for your
reply. I will log an issue there now.
Cheers,
Bob
Hi Bob,
What I have in mind was to use the boost::thread_attributes, but we are
unable to do it in OSX as the set name in OSX sets the name of the
current thread :(
After some thought I believe we could do it by using a trampoline that
will do the setting before calling the user main thread function, but
this is more complex and needs to store the name in the thread_data context.
IIUC, what you are proposing and the single thing that could be done in
an almost portable way and easily is to define two non-member functions
to set and get the thread name on namespace this_thread or any other. Is
this what you are proposing? If this is the case, this functionality can
be developed completely independently of Boost.Thread, isn't' it?
Best,
Vicente