source: grub-pc/trunk/fuentes/grub-core/kern/generic/millisleep.c @ 22

Last change on this file since 22 was 22, checked in by mabarracus, 4 years ago

updated version and apply net.ifnames=0 into debian/rules

File size: 1.4 KB
Line 
1/* millisleep.c - generic millisleep function.
2 * The generic implementation of these functions can be used for architectures
3 * or platforms that do not have a more specialized implementation. */
4/*
5 *  GRUB  --  GRand Unified Bootloader
6 *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
7 *
8 *  GRUB is free software: you can redistribute it and/or modify
9 *  it under the terms of the GNU General Public License as published by
10 *  the Free Software Foundation, either version 3 of the License, or
11 *  (at your option) any later version.
12 *
13 *  GRUB is distributed in the hope that it will be useful,
14 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *  GNU General Public License for more details.
17 *
18 *  You should have received a copy of the GNU General Public License
19 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include <grub/misc.h>
23#include <grub/time.h>
24
25void
26grub_millisleep (grub_uint32_t ms)
27{
28  grub_uint64_t start;
29
30  start = grub_get_time_ms ();
31
32  /* Instead of setting an end time and looping while the current time is
33     less than that, comparing the elapsed sleep time with the desired sleep
34     time handles the (unlikely!) case that the timer would wrap around
35     during the sleep. */
36
37  while (grub_get_time_ms () - start < ms)
38    grub_cpu_idle ();
39}
Note: See TracBrowser for help on using the repository browser.