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/[email protected]
  • Setting process name Anonymouse via Digitalmars-d-learn

Reply via email to