473,503 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's effect to start a timer many times without any stop.

Hi All,

I have a timer, if my data queue Q has data, the timer should start
work, if there is no data in Q, the timer should stop.

However, there is an event can fire timer to start.
Should I add a variable to know how many records inside Q ?

Ya, I think so, because timer should use for unknown events, check it
in a period.

Please advice any of your opinion.

Thanks!

Best regards,
Boki.

Jul 11 '07 #1
4 1905
Timers have start and stop methods, and an elapsed event. You should not
need to start and stop the timer in the queue, but rather, in the elapsed
event handler check if the queue has data.

"Boki" wrote:
Hi All,

I have a timer, if my data queue Q has data, the timer should start
work, if there is no data in Q, the timer should stop.

However, there is an event can fire timer to start.
Should I add a variable to know how many records inside Q ?

Ya, I think so, because timer should use for unknown events, check it
in a period.

Please advice any of your opinion.

Thanks!

Best regards,
Boki.

Jul 11 '07 #2

"Boki" <bo******@ms21.hinet.netwrote in message
news:11*********************@m37g2000prh.googlegro ups.com...
Hi All,

I have a timer, if my data queue Q has data, the timer should start
work, if there is no data in Q, the timer should stop.
For what? Either there is data in the queue or not when the elasped event
for the timer has fired.
>
However, there is an event can fire timer to start.
Should I add a variable to know how many records inside Q ?
Why should you do that? Why do you care? You start the timer, you leave it
started, the Elapsed event fires, and either that is data in the queue or
not.

If there is data in the queue when the timer's Elapsed event firers, the
data is there to be processed or there is no data in the queue. In either
case, the timer is not going back to sleep and counting the time again to
firer its Elapsed event, until the current processing in the Elapsed event
has completed, and the event is exited.
>
Ya, I think so, because timer should use for unknown events, check it
in a period.
For what? The timer checks in when the timer's Elasped event fires. Either
there is data in the queue to be processed or there is no data int the
queue. The only event you should be concerned about is what happens when the
Timer's Elasped event is fired and either there is data to be processed or
there is no data in the queue. The timer goes back into wait mode after the
Elapsed event processing has been completed and starts counting down again.
>
Jul 11 '07 #3
On Jul 11, 8:51 pm, "Mr. Arnold" <MR. Arn...@Arnold.comwrote:
"Boki" <bokit...@ms21.hinet.netwrote in message

news:11*********************@m37g2000prh.googlegro ups.com...
Hi All,
I have a timer, if my data queue Q has data, the timer should start
work, if there is no data in Q, the timer should stop.

For what? Either there is data in the queue or not when the elasped event
for the timer has fired.
However, there is an event can fire timer to start.
Should I add a variable to know how many records inside Q ?

Why should you do that? Why do you care? You start the timer, you leave it
started, the Elapsed event fires, and either that is data in the queue or
not.

If there is data in the queue when the timer's Elapsed event firers, the
data is there to be processed or there is no data in the queue. In either
case, the timer is not going back to sleep and counting the time again to
firer its Elapsed event, until the current processing in the Elapsed event
has completed, and the event is exited.
Ya, I think so, because timer should use for unknown events, check it
in a period.

For what? The timer checks in when the timer's Elasped event fires. Either
there is data in the queue to be processed or there is no data int the
queue. The only event you should be concerned about is what happens when the
Timer's Elasped event is fired and either there is data to be processed or
there is no data in the queue. The timer goes back into wait mode after the
Elapsed event processing has been completed and starts counting down again.

Hi

Because I think, if I already know there is no data in Q, I can save a
machine cycle/resource by disable the timer. That's my idea.

Thank you!
Boki.

Jul 12 '07 #4
If your queue is more often then not empty, then maybe a queue is not really
necessary. A queue is usually for times that you frequently expect some form
of backup.

"Boki" wrote:
On Jul 11, 8:51 pm, "Mr. Arnold" <MR. Arn...@Arnold.comwrote:
"Boki" <bokit...@ms21.hinet.netwrote in message

news:11*********************@m37g2000prh.googlegro ups.com...
Hi All,
I have a timer, if my data queue Q has data, the timer should start
work, if there is no data in Q, the timer should stop.
For what? Either there is data in the queue or not when the elasped event
for the timer has fired.
However, there is an event can fire timer to start.
Should I add a variable to know how many records inside Q ?
Why should you do that? Why do you care? You start the timer, you leave it
started, the Elapsed event fires, and either that is data in the queue or
not.

If there is data in the queue when the timer's Elapsed event firers, the
data is there to be processed or there is no data in the queue. In either
case, the timer is not going back to sleep and counting the time again to
firer its Elapsed event, until the current processing in the Elapsed event
has completed, and the event is exited.
Ya, I think so, because timer should use for unknown events, check it
in a period.
For what? The timer checks in when the timer's Elasped event fires. Either
there is data in the queue to be processed or there is no data int the
queue. The only event you should be concerned about is what happens when the
Timer's Elasped event is fired and either there is data to be processed or
there is no data in the queue. The timer goes back into wait mode after the
Elapsed event processing has been completed and starts counting down again.

Hi

Because I think, if I already know there is no data in Q, I can save a
machine cycle/resource by disable the timer. That's my idea.

Thank you!
Boki.

Jul 12 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
33323
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
137
6928
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very...
125
14539
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
46
4153
by: Keith K | last post by:
Having developed with VB since 1992, I am now VERY interested in C#. I've written several applications with C# and I do enjoy the language. What C# Needs: There are a few things that I do...
1
382
by: BobAchgill | last post by:
Is there a way to kill or stop a timer once it is started? Or is there another better way to preempt a timed process before it times out? I have tried these combinations but timer1 just keeps...
5
1092
by: BobAchgill | last post by:
I have a Form that on a timer uses FTP to update data on the local disk. I would like this Form to start on boot of the computer and stay running still shutdown. Like putting it in the...
5
6152
by: shashwat_k11 | last post by:
Hi, I am writing web service and I want to read a file only once when I start the web service. How can I do that? Which event fires exactly onece when we launch web service? I am reading...
1
1608
by: truedecembr | last post by:
Hi everyone, I am brand new to Java and not really even sure what I'm doing... I'm supposed to be writing a Timer class that is part of a stop watch application, and it seems to me that the program...
10
3048
by: Zytan | last post by:
I made a program using the Timer class, and I start the timer with Timer.Start(), but don't stop it with Timer.Stop(), and I assumed this was ok, but, Process Explorer informs me, after running it...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
382
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.