<p dir="ltr">Thank you, this is a very helpful answer. lwp_gettid() is exactly the thing I need</p>
<div class="gmail_quote">7 февр. 2016 г. 16:52 пользователь "Imre Vadasz" <<a href="mailto:imre@vdsz.com">imre@vdsz.com</a>> написал:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 16:12 Sun 07 Feb , Vasily Postnicov wrote:<br>
> Is there any way in pthread to get a unique descriptor of a thread like<br>
> pthread_self() but with an integer type? Like pthread_getthreadid_np()? If<br>
> no, I can send you a patch for it.<br>
<br>
There doesn't seem to be a pthread function available on DragonFly<br>
for this purpose yet.<br>
But you can use lwp_gettid() on DragonFly (from /usr/include/unistd.h),<br>
the lwpid_t return value is just an int.<br>
<br>
On DragonFly the thread id returned by lwp_gettid() is only unique within<br>
each process, not globally (whereas AFAIK the thread id, returned by<br>
FreeBSD's thr_self() or pthread_getthreadid_np() is globally unique in the<br>
system).<br>
So on DragonFly, to globally identify a specific thread in a specific<br>
process, you'd need both the pid (from getpid()), and the thread id (from<br>
lwp_gettid()).<br>
</blockquote></div>