[lldb-dev] lldb patches for OpenBSD

Matthew Dempsky matthew at dempsky.org
Fri Apr 1 11:45:21 PDT 2011

On Fri, Apr 1, 2011 at 11:33 AM, Greg Clayton <gclayton at apple.com> wrote:
> Dooes linux or BSD have the notion of a thread ID for the current thread that isn't just a pthread_t?

At least with OpenBSD's standard userspace threading library right
now, you can't do any better than the (64-bit) pthread_t.

Once we switch to kernel scheduled threads (which everyone's hoping
will happen soon, but has been a slow multiyear project not likely to
be fully ready for a while yet), you can use the OpenBSD-specific
getthrid() system call, which returns a (32-bit) pid_t identifying the
thread within that process.

I imagine Linux and other BSDs with kernel scheduled threads have
similar system calls to getthrid() already, but I'm not familiar with
those details on other OS's.  (I'm just an OpenBSD kernel hacker
casually interested in LLVM; I'm not really even an expert on our
threading/scheduling code.)

More information about the lldb-dev mailing list