On 16:12 Sun 07 Feb , Vasily Postnicov wrote: > Is there any way in pthread to get a unique descriptor of a thread like > pthread_self() but with an integer type? Like pthread_getthreadid_np()? If > no, I can send you a patch for it.
There doesn't seem to be a pthread function available on DragonFly for this purpose yet. But you can use lwp_gettid() on DragonFly (from /usr/include/unistd.h), the lwpid_t return value is just an int. On DragonFly the thread id returned by lwp_gettid() is only unique within each process, not globally (whereas AFAIK the thread id, returned by FreeBSD's thr_self() or pthread_getthreadid_np() is globally unique in the system). So on DragonFly, to globally identify a specific thread in a specific process, you'd need both the pid (from getpid()), and the thread id (from lwp_gettid()).
