[bootlin/training-materials updates] master: Boot time labs: use "usleep 1000" instead of "sleep 0.001" (30169292)

Michael Opdenacker michael.opdenacker at bootlin.com
Fri Oct 22 11:16:49 CEST 2021


Repository : https://github.com/bootlin/training-materials
On branch  : master
Link       : https://github.com/bootlin/training-materials/commit/30169292ae52d82f226510e5c0b7a11da33b75a1

>---------------------------------------------------------------

commit 30169292ae52d82f226510e5c0b7a11da33b75a1
Author: Michael Opdenacker <michael.opdenacker at bootlin.com>
Date:   Fri Oct 22 11:16:49 2021 +0200

    Boot time labs: use "usleep 1000" instead of "sleep 0.001"
    
    Better to recommend "usleep" than "sleep" here
    
    Signed-off-by: Michael Opdenacker <michael.opdenacker at bootlin.com>


>---------------------------------------------------------------

30169292ae52d82f226510e5c0b7a11da33b75a1
 lab-data/boot-time/rootfs/data/playvideo                              | 2 +-
 labs/boot-time-application/boot-time-application.tex                  | 4 +---
 .../boot-time-filesystem-optimizations.tex                            | 2 +-
 labs/boot-time-init-scripts/boot-time-init-scripts.tex                | 3 ++-
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/lab-data/boot-time/rootfs/data/playvideo b/lab-data/boot-time/rootfs/data/playvideo
index 7dfdb906..1bd5ece7 100755
--- a/lab-data/boot-time/rootfs/data/playvideo
+++ b/lab-data/boot-time/rootfs/data/playvideo
@@ -4,7 +4,7 @@ then
    echo "Waiting for /dev/video0 to be ready..."
    while ! [ -e /dev/video0 ]
    do
-       sleep 0.001
+       usleep 1000
    done
 fi
 echo "Starting ffmpeg"
diff --git a/labs/boot-time-application/boot-time-application.tex b/labs/boot-time-application/boot-time-application.tex
index 39ccb1f3..c6d77851 100644
--- a/labs/boot-time-application/boot-time-application.tex
+++ b/labs/boot-time-application/boot-time-application.tex
@@ -246,7 +246,7 @@ then
    echo "Waiting for /dev/video0 to be ready..."
    while ! [ -e /dev/video0 ]
    do
-       sleep 0.001
+       usleep 1000
    done
 fi
 \end{verbatim}
@@ -256,8 +256,6 @@ Notes:
 \item It seems you can not run an empty \code{while} loop with BusyBox
       \code{sh}. That's why I had to put a real command (not a comment)
       inside the loop.
-\item Fortunately, the \code{sleep} command supports subsecond waiting.
-      Did you know?
 \item When we optimize the kernel, we will try to address this camera
       readiness issue. If we can't fix it, at least we will display
       something on the screen to make the user wait.
diff --git a/labs/boot-time-filesystem-optimizations/boot-time-filesystem-optimizations.tex b/labs/boot-time-filesystem-optimizations/boot-time-filesystem-optimizations.tex
index 5217ae93..cef63316 100644
--- a/labs/boot-time-filesystem-optimizations/boot-time-filesystem-optimizations.tex
+++ b/labs/boot-time-filesystem-optimizations/boot-time-filesystem-optimizations.tex
@@ -149,7 +149,7 @@ then
    echo "Waiting for /dev/video0 to be ready..." > /dev/console
    while ! [ -e /dev/video0 ]
    do
-       sleep 0.001
+       usleep 1000
    done
 fi
 echo "Starting ffmpeg" > /dev/console
diff --git a/labs/boot-time-init-scripts/boot-time-init-scripts.tex b/labs/boot-time-init-scripts/boot-time-init-scripts.tex
index 26da5f3d..de515928 100644
--- a/labs/boot-time-init-scripts/boot-time-init-scripts.tex
+++ b/labs/boot-time-init-scripts/boot-time-init-scripts.tex
@@ -346,7 +346,8 @@ Just select the below options, based on what we have in our
   \end{itemize}
   \item In \code{Coreutils}:
   \begin{itemize}
-     \item Support for the \code{sleep} command, with support for fractional arguments.
+     \item Support for the \code{usleep} command, allowing to specify
+           sleep time in microseconds.
      \item Support for the \code{echo} command, without additional options.
      \item Enable \code{test} and \code{test as [}
      \item Disable \code{Extend test to 64 bit}




More information about the training-materials-updates mailing list