Re: race condition
Beco <rcb@beco.cc> writes:
> After implementing the score (using SGID), I have a race condition in my
> game.
> The comparisson is between the just scored point with the last point
> in the top-10.
> readscore_file2memory();
> If(pt>top[9])
> {
> printf("Congrats... and stuff\n");
> reorderscore_memory();
> savescore_memory2file();
> }
> What would be the standard way to lock the scorefile?
fcntl(fd, F_SETLK). See fcntl(2).
--
Russ Allbery (rra@debian.org) <http://www.eyrie.org/~eagle/>
Reply to: