Re: Re-entrancy???
- From: "Eduardo" <mm@xxxxxx>
- Date: Thu, 27 Nov 2008 09:40:51 -0300
Cute :) It was actually Eduardo who claimed it was 1 ms, then after he
either tested it or read the documentation he came back and admitted it
was 16 ms. so seems the person you are saying was right, clearly did not
know about the need to change the timer interval. As none of them stated
this *requirement* I thin it is indeed very safe to assume they didn't
know, especially given their responses when challenged on the matter.
I already told you, for the case, 1 ms or 16 ms make not a big difference.
Wake up, you are running it on Windows.
Unless you use the timeXXXPeriod APIs as some have pointed.
No my comments were pretty clear (at least I thought <g>) I said for the
code that the OP posted which appears to be polling a PLC and does so at
intervals controlled by Timer event, there is absolutely no reason to add
extra sleep calls in that code.
If that is still unclear to you, I suggest you look at the code the OP
posted.
I believe that you are deliberately trying to confuse things.
As i pointed already once and you ignored it, the OP had the problem that
the one second timer was firing again when the PLC still didn't respond to
the previous event of one second earlier. So, at least sometimes, it runs
continuosly in the loop. How often? I don't know, but may be often. So it is
almost like a continuous loop.
My final words are:
When i read the OP first message, i just assumed it was logging some data to
a database or monitoring a process in the PC monitor, or something like
that.
I really didn't think that he was doing a critical process in real time. And
i still
think it must be the first option, the OP never said that he was managing a
robotic machine in real time from the PC.
It was in fact you that started with the idea that the OP was controlling a
process in real time there.
The OP wasn't against the use of Sleep, but he undestood that using Sleep
means to remove Doevents. (Well, in my first message in the thread i said to
remove Doevents, but just to point where the problem was [the timer was
firing again when the last one was still processing] and to use Sleep but
not as a replacement for Doevents. I wanted to answer quiecky because i
had to do other things and i didn't had the time to explain the whole thing
at
that moment).
So, if he is just logging data or monitoring, he can safely place a Sleep
100 (well, we would have to see how much data he is receiving and the input
buffer size, but at least Sleep 1 is safe surely). Then the CPU runs
quietly.
If he is really controling a process in real time, then i would strongly
suggest not to do it in Windows.
I don't see the need of any closed-Doevents-loops-without-Sleep in none of
the two
cases.
.
- Follow-Ups:
- Re: Re-entrancy???
- From: Bill McCarthy
- Re: Re-entrancy???
- From: Eduardo
- Re: Re-entrancy???
- References:
- Re-entrancy???
- From: Steve
- Re: Re-entrancy???
- From: Jim Mack
- Re: Re-entrancy???
- From: Steve
- Re: Re-entrancy???
- From: Eduardo
- Re: Re-entrancy???
- From: Steve
- Re: Re-entrancy???
- From: Eduardo
- Re: Re-entrancy???
- From: Steve
- Re: Re-entrancy???
- From: Larry Serflaten
- Re: Re-entrancy???
- From: Bill McCarthy
- Re: Re-entrancy???
- From: Larry Serflaten
- Re: Re-entrancy???
- From: Bill McCarthy
- Re: Re-entrancy???
- From: Schmidt
- Re: Re-entrancy???
- From: Bill McCarthy
- Re: Re-entrancy???
- From: Schmidt
- Re: Re-entrancy???
- From: Bill McCarthy
- Re-entrancy???
- Prev by Date: Re: Algorithm of a booking system to turn ON/OFF equipments
- Next by Date: Re: Re-entrancy???
- Previous by thread: Re: Re-entrancy???
- Next by thread: Re: Re-entrancy???
- Index(es):
Relevant Pages
|