[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 14:49:48 -0200
On Fri, Nov 23, 2012 at 5:33 AM, Benoit Germain <bnt.germain@gmail.com> wrote:
> The problem is that not all variants of pthread have pthread_setname_np, but
> I don't know how to detect that situation for all possible configurations.
> Among others, Debian doesn't have it, but how do I know that Lanes is built
> with Debian?
The phtreads from my vanilla-built Glibc doesn't include it either.
Looks like it is available only in Glibc >= 2.12.
> I just don't want to jump through the autoconf hoops...
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).
-- Hisham
http://hisham.hm/