threading question
Charles G Waldman
cgw at fnal.gov
Wed Jul 28 00:30:42 EDT 1999
When I run the trivial example attached below, which simply
starts a daemon thread that does nothing, and then type "ps",
I see *three* python processes. I can understand two, but
why three?
Platform is Linux 2.2.10 with the most recent glibc (2.1.1),
if that matters.
Thanks in advance for any pointers. Or, since this is Python,
better make that "references".
from threading import *
import time
class Test:
def __init__(self):
self.test = Thread(group=None,
target=self.thread_fn,
name="thread1",
)
self.test.setDaemon(1)
self.test.start()
def thread_fn(self):
while 1:
time.sleep(1)
if __name__ == "__main__":
x = Test()
while 1:
time.sleep(1)
More information about the Python-list
mailing list