New version of mock working (I think)

Dan Williams dcbw at redhat.com
Tue Jun 27 18:03:40 UTC 2006


On Tue, 2006-06-27 at 11:15 -0500, Clark Williams wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Mike McLean wrote:
> > Clark Williams wrote:
> >> Not smart enough to argue that we should wait for our build system
> >> clients to weigh in. Sigh...
> >>
> >> Dan/Jeremy/Mike/Andreas/et al
> >>
> >> How are you going to use file locking? Do you just want mock to lock
> >> the status file when we're changing state, or is there something else
> >> I'm missing?
> >
> > Pretty much. The lock is to prevent the watcher from reading a
> > partially written status file.
> 
> Something like :
> 
>     flock(fileno, LOCK_EX)
>     <write new status>
>     flock(fileno, LOCK_UN)
> 
> That what you're looking for?

In python:

import fcntl
lkfd = open(<lockfile_path>, 'w')
rc = fcntl.flock(lkfd, fcntl.LOCK_EX)
<write new status>
fcntl.flock(lkfd, fcntl.LOCK_UN)
close(lkfd)

Yes.

Dan





More information about the Fedora-buildsys-list mailing list