Danny Yoo wrote:
>>I think I see where you are going with this. Are you suggesting that
>>both parent and child thread might be trying to write to the log at
>>once, and one of them is closing the file while it is open for both?
> 
> 
> Hi Bernard,
> 
> One possibility is that we have a shared resource that needs some kind of
> mutual exclusion.  If two threads try to append directly to the file, I
> don't know what will happen, but the result will probably not be good.
> 
> 
> But the Queue module can be especially useful here:
> 
>     http://www.python.org/doc/lib/module-Queue.html
> 
> The idea is that we keep a separate logger thread that reads messages off
> a Queue instance.

You might be interested in the standard logging module which is 
thread-safe and supports logging to a file, rather than inventing your own.

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to