Pausing/Waiting in C

D

David T. Ashley

Barry said:
Of course we have gotten so far off topic for clc it doesn't matter.
But, every embedded system I have worked on (and you have used all
of them, directly or indirectly :)) also respond to hardware interrupts.

That has been my experience, too. I work in the auto industry, and typical
interrupts are timekeeping (i.e. periodic interrupt) and vehicle network
receive.

I think in the abstract it would be possible to find a small embedded system
without interrupts ... just that I've never encountered one.

I thought about this briefly as I was typing my post, but decided it would
just add unnecessary complexity. The important point for the individual I
was responding to is that in most applications (except small embedded
systems), spin-locking the CPU to get a time delay is usually a bad thing to
do.
 
R

Randy Howard

OS-dependent question.

Any form of spin-wait is bad programming practice (but I suppose it would
work).

In Linux it is usleep():

Maybe, maybe not. In some cases, nanosleep() is better. Yet another
example of why it's better to just redirect them to an appropriate
group.
In Windows, I'm not sure, but there are various references on the Microsoft
website to sleep(). Since Microsoft tries to support straightforward Unix
applications, there is a good chance you'll find sleep() or usleep() as a
Windows API system call.

And you also find Sleep() [note the upper case S]

Ditto above...
 
K

Keith Thompson

David T. Ashley said:
If you have any further questions or observations, please write me directly
at (e-mail address removed) and answer my SPAM filtering system's automatic reply. I
might know one or two things about small embedded systems.

Or take it to comp.arch.embedded.
 
M

Mark McIntyre

(snip rest of quote from FAQ)
Most of your response has nothing to do with C.

You do know it was a quote from this groups FAQ don't you?
Instead you posed a response irrelevant to C, and lacking of
many proper solutions.

If you think the FAQ wrong, suggest some corrections to Steve Summit,
who owns it.

"The lusers I know are so clueless, that if they were dipped in clue
musk and dropped in the middle of pack of horny clues, on clue prom
night during clue happy hour, they still couldn't get a clue."
 
C

Clark S. Cox III

Barry said:
user923005 said:
19.37: How can I implement a delay, or time a user's response, with
....
[snip]
....
References: H&S Sec. 18.1 pp. 398-9; PCS Sec. 12 pp. 197-8,215-
6; POSIX Sec. 4.5.2.

Most of your response has nothing to do with C. You should have
just referred the OP to an appropriate news group.

Instead you posed a response irrelevant to C, and lacking of
many proper solutions.

The post came straight from *this group's FAQ*. I can't imagine a more
on-topic or relevant-to-C source of information for this group.
 
U

user923005

Barry said:
Most of your response has nothing to do with C. You should have
just referred the OP to an appropriate news group.

Instead you posed a response irrelevant to C, and lacking of
many proper solutions.

I assume that your response is a joke.
Otherwise, I guess that you are a troll.
Do you know what the C-FAQ is? If so, next time add a smiley for me:
;-)
I'm smiley imparied sometimes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top