Alejandro <alejandro.weinst...@gmail.com> writes: > Hi: > > I have Python program running under Linux, that create several > threads, and I want to now the corresponding PID of the threads. > > In each of the threads I have > > def run(self): > pid = os.getpid() > logger.critical('process ID: %s', pid) > > However, the reported PID is the father number, not the PID of the new > thread. Is there a way to get the PID of the thread?
Pid is a process identifier. Threads are not processes. All your threads execute within the context if a single process, hence they should have the same pid. Threads may have a thread id but it is not the same as the pid. -- http://mail.python.org/mailman/listinfo/python-list