Ervin Hegedüs wrote: > I've made a long-time running daemon, which uses threads. Looks > like that works perfectly, now I'm looking at the exceptions :). > > In the log, I found an interesting message: > > Exception in thread Thread-82: > ... > > The main function allows 2 thread to run simultaniously, and if > the thread finished, then it joined with th.join(), where the > "th" is the thread item, derived from threading.Thread class. > > My question is: how much thread ID could be totally? Is there any > maximum number? And if the thread reached that, what will be > done? Overlflowed? Couting from 0 again?
A quick peak into threading.py reveals # Helper to generate new thread names _counter = 0 def _newname(template="Thread-%d"): global _counter _counter += 1 return template % _counter class Thread: ... def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None): ... self._name = str(name or _newname()) There is no upper limit to the thread name other than that you will eventually run out of memory ;) -- https://mail.python.org/mailman/listinfo/python-list