06-14-2004
Introducing Delay less then a second.
Hi,
I have a doubt in introducing a delay in the programs.
We know that we do have a sleep() function/api using which
we can bring a delay in terms of seconds.
A minimum delay can be atleast 1 second.
Now I'm bothered about how to introduce a delay that is just
less than a second. Like some amount of milli or microsecond delay.
Drivers that are associated with physical devices some time
requires to have a delay of some microsceonds for getting a
result of a query that has been submitted to the device.
So, how to introduce this microsecond delay. Probably like
we might requre some microseconds as the poling interval.
So, how to achieve this.
Let me know your ideas.
Regards
Vishwa.
3 More Discussions You Might Find Interesting
1. What is on Your Mind?
Hey guys, I am Shelby! :-) I am 13 years old and i love Unix. When i was about 6 i was introduced to computers, because almost all of my family is comprised of artists, i used macs at a very early age. I generally sat on the computer until the time i was about 10 when i walked into a laptop store... (2 Replies)
Discussion started by: mesaynaysayer
2 Replies
2. Programming
Hi guys,
I'm the maintainer of Imperfect world of Robots, and I'm here to introduce this project to any AI lover. This is a free (as in freedom) software and release under the terms of GNU General Public License.
Although it belongs to the programming game category, it's not only about... (0 Replies)
Discussion started by: aidin_36
0 Replies
3. What is on Your Mind?
Hello! I didn't see an Introduce Yourself/Meet and Greet board, so I think this might be the right place.
I'm a student and a new coder. I run Ubuntu 11.10 currently, and I program in Python, and I'm learning a few languages alongside.
Random pages:
Twitter - @NihilusV, other links can... (1 Reply)
Discussion started by: NihilusV
1 Replies
LEARN ABOUT XFREE86
drv_usecwait
drv_usecwait(9F) Kernel Functions for Drivers drv_usecwait(9F)
NAME
drv_usecwait - busy-wait for specified interval
SYNOPSIS
#include <sys/types.h>
#include <sys/ddi.h>
void drv_usecwait(clock_t microsecs);
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
PARAMETERS
microsecs The number of microseconds to busy-wait.
DESCRIPTION
drv_usecwait() gives drivers a means of busy-waiting for a specified microsecond count. The amount of time spent busy-waiting may be
greater than the microsecond count but will minimally be the number of microseconds specified.
delay(9F) can be used by a driver to delay for a specified number of system ticks, but it has two limitations. First, the granularity of
the wait time is limited to one clock tick, which may be more time than is needed for the delay. Second, delay(9F) may only be invoked
from user context and hence cannot be used at interrupt time or system initialization.
Often, drivers need to delay for only a few microseconds, waiting for a write to a device register to be picked up by the device. In this
case, even in user context, delay(9F) produces too long a wait period.
CONTEXT
drv_usecwait() can be called from user or interrupt context.
SEE ALSO
delay(9F), timeout(9F), untimeout(9F)
Writing Device Drivers
NOTES
The driver wastes processor time by making this call since drv_usecwait() does not block but simply busy-waits. The driver should only make
calls to drv_usecwait() as needed, and only for as much time as needed. drv_usecwait() does not mask out interrupts.
SunOS 5.10 12 Nov 1992 drv_usecwait(9F)