[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: HELP! problem with run LuaLanes
- From: Hisham <h@...>
- Date: Mon, 26 Nov 2012 16:06:05 -0200
On Mon, Nov 26, 2012 at 3:34 PM, Benoit Germain <bnt.germain@gmail.com> wrote:
>
> 2012/11/26 Hisham <h@hisham.hm>
>>
>> One alternative is to detect Linux with `#ifdef linux` (or Glibc <
>> 2.12; there's probably an #ifdef for that) and use prctl(2) instead.
>> It works fine on threads:
>>
>> prctl(PR_SET_NAME, "myThread", 0, 0, 0);
>>
>> This edits the name that shows up in /proc/$$/stat (I suppose that's
>> the thread name you want to edit? At least that's the one I use for
>> displaying thread names in htop).
>>
>
> I check for linux with
>
> #ifdef __linux__
>
> and I found that I can also check glibc version with
>
>
> #define __GLIBC__ 2
> #define __GLIBC_MINOR__ 4
>
>
> Anyway, prctl isn't what I want since I want to set the name of the thread,
> not the process. But fixing the build issue is good enough for now :-).
I don't know if what you want is to set the actual name of the thread
in the kernel sense (ie, the name that shows up in /proc) or if
pthread keeps its own data structures with logical thread names, but
prctl does set the names for individual threads (ie, for the specific
PID corresponding for each different thread started by a process) when
called from within the thread. (I'm referring to the specifc names
that show up in
/proc/$PID/task/$TID/stat).
Hope that helps!
-- Hisham
http://hisham.hm/
- References:
- HELP! problem with run LuaLanes, "Гришин В.С."
- Re: HELP! problem with run LuaLanes, Benoit Germain
- Re: HELP! problem with run LuaLanes, "Гришин В.С."
- Re: HELP! problem with run LuaLanes, Hisham
- Re: HELP! problem with run LuaLanes, "Гришин В.С."
- Re: HELP! problem with run LuaLanes, Benoit Germain
- Re: HELP! problem with run LuaLanes, "Гришин В.С."
- Re: HELP! problem with run LuaLanes, Benoit Germain
- Re: HELP! problem with run LuaLanes, Hisham
- Re: HELP! problem with run LuaLanes, Benoit Germain