cgi "print statement" in multithreaded enviroment?

vegetax vegeta.z at gmail.com
Mon May 2 22:04:40 EDT 2005


Jeff Epler wrote:

> 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

Thats what i was looking for,Thanks =)




More information about the Python-list mailing list