En Sun, 01 Mar 2009 16:11:41 -0200, Nigel Rantor <wig...@wiggly.org>
escribió:
bruce wrote:
i can easily setup a file read/write lock process where a client app
gets/locks a file, and then copies/moves the required files from the
initial
dir to a tmp dir. after the move/copy, the lock is released, and the
client
can go ahead and do whatever with the files in the tmp dir.. thie
process
allows multiple clients to operate in a psuedo parallel manner...
I'm really not sure why you want to move the files around. Here are two
different approaches from the one I initially gave you that deals
perfectly well with a directory where files are constantly being added.
This is a third approach - simpler than Bruce's.
Each process chooses any file and tries to rename/move it onto a different
directory. Rename is an atomic operation (at least on POSIX) so no locks
are required. If the rename fails, choose another file and try again.
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list