mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-20 18:17:20 +00:00
Sleep less in update-game-score
This is mostly to avoid interface hassles with time/srand/rand. * lib-src/update-game-score.c (main): Don’t use ‘srand’ or ‘time’. (lock_file): Don’t sleep if we unlocked the lock file. When sleeping, always just sleep 1 s. This avoids the need for calling ‘time’ and ‘rand’, the utility of which was dubious anyway.
This commit is contained in:
parent
2e8cc206f5
commit
640fd9b594
@ -185,8 +185,6 @@ main (int argc, char **argv)
|
||||
ptrdiff_t scorecount, scorealloc;
|
||||
ptrdiff_t max_scores = MAX_SCORES;
|
||||
|
||||
srand (time (0));
|
||||
|
||||
while ((c = getopt (argc, argv, "hrm:d:")) != -1)
|
||||
switch (c)
|
||||
{
|
||||
@ -485,8 +483,8 @@ lock_file (const char *filename, void **state)
|
||||
return -1;
|
||||
attempts = 0;
|
||||
}
|
||||
|
||||
sleep ((rand () & 1) + 1);
|
||||
else
|
||||
sleep (1);
|
||||
}
|
||||
|
||||
close (fd);
|
||||
|
Loading…
Reference in New Issue
Block a user