file write collision consideration

RGK blank at empty.blank
Tue Jan 20 16:57:52 CET 2009

I have a thread that is off reading things some of which will get 
written into a file while another UI thread manages input from a user.

The reader-thread and the UI-thread will both want to write stuff to the 
same output file. What first comes to mind is that there may be write 
collisions, ie both trying to write at the same time.

Should I do something like:

if busyFlag:
   while busyFlag:
   busyFlag = True
   {write stuff to file}
   busyFlag = False

in both threads?   Is there some other approach that would be more 

Thanks in advance for your advice
- Ross.

More information about the Python-list mailing list