Setting process name

Anonymouse asdf at asdf.net
Thu May 2 02:47:45 UTC 2019


Is there a way of setting the process/thread name that's neater 
than this?

import core.sys.posix.pthread;

extern(C) int pthread_setname_np(pthread_t, const char*);

void main()
{
     import std.string : toStringz;
     pthread_setname_np(pthread_self(), toStringz("thread_name"));
     // ...
}

It seems to work, but it also seems peculiar that 
pthread_setname_np isn't in core.sys.posix.pthread with the rest. 
Why is this? Is there an easier way? Thread.getThis().name 
doesn't seem to be it.


https://forum.dlang.org/thread/gudwwmmdcqrfhbduxruq@forum.dlang.org


More information about the Digitalmars-d-learn mailing list