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?
相关问题
- Multiple sockets for clients to connect to
- Is shmid returned by shmget() unique across proces
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- how to get running process information in java?
I needed to include
<linux/delay.h>
to use msleep in kernel space.Linux kernel documentation
The Linux kernel documentation under Documentation/timers/timers-howto.txt has a good rundown of the main methods:
Adapted from this awesome answer: https://stackoverflow.com/a/39921020/895245
Next have a look at the documentation comment on each of those functions in the source. E.g.:
usleep_range
:LDD3 7.3. Delaying Execution is another must-have resource.
Minimal runnable examples
Finally write your own minimal tests to try them out!
GitHub upsteram.