How to sleep in the Linux kernel?

John Roberts picture John Roberts · Apr 14, 2013 · Viewed 53.2k times · Source

Can I use the msleep() function to sleep for a specified amount of time in kernel space? If so, which header files do I need to include? #include <linux/time.h> doesn't seem to be the right one. Is there perhaps a better function for this purpose?

Answer

John Roberts picture John Roberts · Apr 14, 2013

I needed to include <linux/delay.h> to use msleep in kernel space.