View Single Post
  #2   (View Single Post)  
Old 10th September 2008
Fritz_Katz's Avatar
Fritz_Katz Fritz_Katz is offline
Video-4-BSD
 
Join Date: Jul 2008
Location: Los Angeles, CA
Posts: 9
Default msleep on Linux vs. FreeBSD

I've often wondered about the differences between the Linux msleep and FreeBSD msleep -- I've actually lost some sleep thinking about it. They appear to be the same in name only. Am I confused here? If so, jump in and correct me.

The Linux msleep simply goes into a while spin-loop counting down a timeout on schedule_timeout_uninterruptible( ). It seems to be a closer match to the Standard C library call: usleep.

The FreeBSD msleep seems to be a different beast entirely. A better name would be 'mutex_sleep' since that is what it does. In fact, we shouldn't use FreeBSD msleep since it has been depreciated, use mtx_sleep instead.

For linux_kmod_compat would a better match to the Linux msleep be the FreeBSD kernel function pause?:
void pause(const char *wmesg, int timo);
or is there something better for use in the kernel, drivers, and KLDs?
__________________
- Fritz Katz
Reply With Quote