cgi "print statement" in multithreaded enviroment?

Jeff Epler jepler at unpythonic.net
Mon May 2 21:37:16 EDT 2005


You could write something like
    class ThreadSpecificFile:
        def set_stdout(f):
            self.files[thread_id] = f
        def write(data):
            self.files[thread_id].write(data)
    sys.stdout = ThreadSpecificFile()
where you'll have to fill out a few more things like thread_id,
__init__, and a way to clean up items from self.files when a thread
passes away.

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050502/01ee00c0/attachment.sig>


More information about the Python-list mailing list