How to make a kernel thread sleep for a short amount of time?

From: Ben Greear (greearb@candelatech.com)
Date: Thu Jul 04 2002 - 16:22:29 EST


I am re-working the net/core/pktgen code to be a kernel thread.

It is basically working, but I am having trouble making the thread
efficiently sleep for durations in the milisecond and micro-second range.

I have looked at the udelay and mdelay methods, but they busy
wait.

I do not need absolute real-time precision, so if I ask the thread
to sleep for 100 micro-seconds, it is not a big deal if it does
not wake up for 5000us. On average, it should be very close to 100us.

I believe the answer may be to use some sort of timer and have my
thread sleep on this timer, but I cannot find any examples or
documentation on how to do this on the web.

If anyone can point me to some example code or documentation, I
would appreciate it.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>       <Ben_Greear AT excite.com>
President of Candela Technologies Inc      http://www.candelatech.com
ScryMUD:  http://scry.wanfear.com     http://scry.wanfear.com/~greear

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jul 07 2002 - 22:00:13 EST