Skip to content

Commit

Permalink
Boot time labs: use "usleep 1000" instead of "sleep 0.001"
Browse files Browse the repository at this point in the history
Better to recommend "usleep" than "sleep" here

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
  • Loading branch information
michaelopdenacker committed Oct 22, 2021
1 parent 4ea6c72 commit 3016929
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lab-data/boot-time/rootfs/data/playvideo
Expand Up @@ -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"
Expand Down
4 changes: 1 addition & 3 deletions labs/boot-time-application/boot-time-application.tex
Expand Up @@ -246,7 +246,7 @@ \section{Putting things back together}
echo "Waiting for /dev/video0 to be ready..."
while ! [ -e /dev/video0 ]
do
sleep 0.001
usleep 1000
done
fi
\end{verbatim}
Expand All @@ -256,8 +256,6 @@ \section{Putting things back together}
\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.
Expand Down
Expand Up @@ -149,7 +149,7 @@ \section{Initramfs tests}
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
Expand Down
3 changes: 2 additions & 1 deletion labs/boot-time-init-scripts/boot-time-init-scripts.tex
Expand Up @@ -346,7 +346,8 @@ \subsection{Reducing BusyBox to the minimum}
\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}
Expand Down

0 comments on commit 3016929

Please sign in to comment.