473,322 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Activating timer from other thread

Hello. I have a multi threaded application (I use threadpool). The main
thread has some timers. In some circumstances, I need to activate one of
these timers from other thread.

I activate the timer with enabled property, but the tick event won't raise.

What's the problem with that? Any solution?

--

Regards,

Diego F.

May 28 '07 #1
3 1200
Diego,

One of the main purposes from using threads is that they are not working
synchonized but assynchroon.

If you now want a synchronized assynchroon sollution, than you should look
in my idea first to your solution. However just my idea.

Cor

"Diego F." <di********@msn.comschreef in bericht
news:OZ*************@TK2MSFTNGP05.phx.gbl...
Hello. I have a multi threaded application (I use threadpool). The main
thread has some timers. In some circumstances, I need to activate one of
these timers from other thread.

I activate the timer with enabled property, but the tick event won't
raise.

What's the problem with that? Any solution?

--

Regards,

Diego F.

May 28 '07 #2
Sorry, I don't understand you. What do you mean by your idea?

--

Regards,

Diego F.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Diego,

One of the main purposes from using threads is that they are not working
synchonized but assynchroon.

If you now want a synchronized assynchroon sollution, than you should look
in my idea first to your solution. However just my idea.

Cor

"Diego F." <di********@msn.comschreef in bericht
news:OZ*************@TK2MSFTNGP05.phx.gbl...
>Hello. I have a multi threaded application (I use threadpool). The main
thread has some timers. In some circumstances, I need to activate one of
these timers from other thread.

I activate the timer with enabled property, but the tick event won't
raise.

What's the problem with that? Any solution?

--

Regards,

Diego F.


May 28 '07 #3
Since you described using the 'Enabled' property on the timer, I see you're
using System.Windows.Forms.Timer. This is not good to use in multi-threaded
applications unless the timer is used entirely within the GUI thread (within
the form which contains the timer). Rather, use System.Threading.Timer
instead. It invokes a method of your choice asynchronously at the intervals
specified. Also, you could consider utilizing Threading.Sleep within a loop
on your thread to achieve timer like functionality.

Best regards,
Andrew

"Diego F." <di********@msn.comwrote in message
news:OZ*************@TK2MSFTNGP05.phx.gbl...
Hello. I have a multi threaded application (I use threadpool). The main
thread has some timers. In some circumstances, I need to activate one of
these timers from other thread.

I activate the timer with enabled property, but the tick event won't
raise.

What's the problem with that? Any solution?

--

Regards,

Diego F.
May 29 '07 #4

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

Similar topics

5
by: Richard P | last post by:
I need some help on timers. My app is asp.net 1.1 website running in a shared hosting environment with a third-party service provider. I currently request and cache 20 - 40 remote RSS feeds. When a...
4
by: Anthony Boudouvas | last post by:
Hi to all, i have a form with 2 System.Windows.Forms.Timer objects. One fire every 5 seconds and the other every 10 seconds, the both take actions in two hashtables declared in same form. ...
8
by: Daniel P. | last post by:
I'm trying to set a timer that gets called every 3 seconds so I can update a field in the UI with the time elapsed since the process started. What am I doing wrong that timerDF_Tick does not get...
6
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
7
by: RobKinney1 | last post by:
Hello, Wow...I have one for you all and hopefully I am not understanding this timer object correctly. I have a timer setup that pulses a connection through a socket every 60 seconds. But it...
5
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the...
3
by: Beemer Biker | last post by:
Unaccountably, I cannot re-enable a timer from an background thread. The disable works fine, I just cannot get it to start back up. There is no method "InvokeRequired" like there is for...
2
by: RP | last post by:
I have a Timer control on a form. When this Timer starts, it will do certain task on every tick. I want that this Timer be linked to a new thread so that the Timer does not disturb other...
3
by: Steve | last post by:
Hi All I am using VB.net 2008 and use timer controls within my applications Question Does the code in a Timer control.tick event run on a different thread to the main Application thread (UI...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.