file write collision consideration
RGK
blank at empty.blank
Tue Jan 20 10:57:52 EST 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:
sleep(10)
else:
busyFlag = True
{write stuff to file}
busyFlag = False
in both threads? Is there some other approach that would be more
appropriate?
Thanks in advance for your advice
- Ross.
More information about the Python-list
mailing list