473,469 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Overlapping timer notificatoins?

If I have a long task to do in my timer event, how can I properlystop
my timer again being notified again while I am still processing?

Thanks.

Adam

Nov 17 '05 #1
2 2362
I am not sure I completely understand your question. See if this helps at
all.

You can have many timers running at once. If you use System.Timers you use
the Elapsed event to run your code in if you are using System.Windows.Forms
for your timers you use use use the Tick event.

If you want to make your code run without holding up the rest of your
application you can use System.Threading inside your Tick or Elapsed event
handler.

If you want to make your new thread pause so it doesn't use cpu for a while
you can do so with the thread.Sleep function.

I don't know much about what you are trying to do inside of the thread, but
please note that there are some things that don't play nice when in a
thread.

Hope this helps,
Nathan

"Adam" <ad*********@hotmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
If I have a long task to do in my timer event, how can I properlystop
my timer again being notified again while I am still processing?

Thanks.

Adam

Nov 17 '05 #2
Let me clarify with an extreme example. Say I only have 1 timer, set
to fire off at intervals of one minute.

Say in the first invocation, I do some database work which takes two
minutes to complete. During that, I'll get a second timer message (in
the same timer) which I don't want.

How can I stop this?

Thanks.

Nathan Kovac wrote:
I am not sure I completely understand your question. See if this helps at
all.

You can have many timers running at once. If you use System.Timers you use
the Elapsed event to run your code in if you are using System.Windows.Forms
for your timers you use use use the Tick event.

If you want to make your code run without holding up the rest of your
application you can use System.Threading inside your Tick or Elapsed event
handler.

If you want to make your new thread pause so it doesn't use cpu for a while
you can do so with the thread.Sleep function.

I don't know much about what you are trying to do inside of the thread, but
please note that there are some things that don't play nice when in a
thread.

Hope this helps,
Nathan

"Adam" <ad*********@hotmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
If I have a long task to do in my timer event, how can I properlystop
my timer again being notified again while I am still processing?

Thanks.

Adam


Nov 17 '05 #3

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

Similar topics

1
by: km | last post by:
Hi all, python re module deals with only nonoverlapping matches. how to go for if i want to find out overlapping matches and their span ? regards, KM
1
by: André Søreng | last post by:
With the re/sre module included with Python 2.4: pattern = "(?P<id1>avi)|(?P<id2>avi|mp3)" string2match = "some string with avi in it" matches = re.finditer(pattern, string2match) .......
11
by: Max M | last post by:
I am writing a "find-free-time" function for a calendar. There are a lot of time spans with start end times, some overlapping, some not. To find the free time spans, I first need to convert the...
3
by: Phil Sandler | last post by:
All, I have a table with start and end dates/times in it, and would like to be able to calculate the number of hours represented, accounting for overlapping records. Note that I am looking...
4
by: Simon Elliott | last post by:
Is there an equivalent of std::copy which works on STL containers for overlapping ranges? -- Simon Elliott http://www.ctsn.co.uk
0
by: Bruce | last post by:
Hello, Back in the Access 97 days, if I had two texboxes on a form or report that overlapped, and I selected both and did a Format, Align, Top from the menu in design view, the controls would...
4
by: Charlie Brown | last post by:
I have a form with 2 custom controls that can be dragged around by a user. How can I check if they overlap each other without performing some kind of Collision detection on them? Is there...
4
by: =?ISO-8859-15?Q?Jean=2DFran=E7ois?= Lemaire | last post by:
Hello all, I'm learning C and I still am struggling to understand some basic concepts. For example, I read in the standard that with functions such as strcpy, 'If copying takes place between...
3
by: cowboyrocks2009 | last post by:
Hi, I am trying to write a Java program to plot rectangles with different colors side by side non overlapping but unfortunately I am unable to do that as of now. Suppose I want to create 3...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
1
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
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.