12

I have a main thread that gets connections and immediately spawns new threads then inside the thread it receives a name that gets logged, currently my threads are named Thread-n. I would like to change the name of the thread from inside. I found this, but it sadly only works on linux, any similar program to do this on Windows?

Hakaishin
  • 2,550
  • 3
  • 27
  • 45

1 Answers1

13

One can do this by using:

import threading
threading.current_thread().name = "my_name"
acapola
  • 1,078
  • 1
  • 12
  • 23
Hakaishin
  • 2,550
  • 3
  • 27
  • 45