getTid wrapper

Timothee Cour thelastmammoth at gmail.com
Mon Mar 3 22:31:11 PST 2014


On Mon, Mar 3, 2014 at 10:19 PM, Bienlein <jeti789 at web.de> wrote:

> On Tuesday, 4 March 2014 at 04:39:33 UTC, Timothee Cour wrote:
>
>> I couldn't find a wrapper to get current thread id.
>> There is Thread.getThis but the address it returns is the same for all
>> threads as explained here (http://ddili.org/ders/d.en/concurrency.html)
>> so
>> it's not useful for logging.
>>
>> How about adding this:
>> auto getTid() to class Thread
>> Implementation on OSX:
>> mach_port_t tid = pthread_mach_thread_np(pthread_self());
>>
>
> The spawn function returns the tid, see the sample here:
> http://dlang.org/phobos/std_concurrency.html
>
>
that gives tid of spawned thread, not 'self'.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20140303/6f1d81d0/attachment.html>


More information about the Digitalmars-d-learn mailing list