Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

i'm facing a problem with multiple timers where i have two different type of functionalities for timers with the same interval, so in order to achieve asynchronous exection i'm using System.Timers.Timer where these timers will be created on Server(system) thread but not on application thread.

so i have two long running functions.when i tried to invoke them in two different timers,here in my case 2nd timer is waiting for 1st timer to complete its execution so i was unable to make them asynchronous, still they are running in que but not in parllel


here is my raw code
--------------------------------------------
Public Class MainForm

VB
Private Shared CrTimer As New System.Timers.Timer()
Private Shared QfTimer As New System.Timers.Timer()


VB
Delegate Sub SetTextCallback(ByVal [text] As String)
Delegate Sub SetTextCallback1(ByVal [text] As String)

Private sub MainForm_Load
AddHandler QfTimer.Elapsed, AddressOf QfTimer_Tick
AddHandler CrTimer.Elapsed, AddressOf CrTimer_Tick
QfTimer.Interval =1000000
CrTimer,Interval =1000000
QfTimer.Start()
CrTimer.Start()
End sub
Private Sub CrTimer_Tick()
C#
Dim d As New SetTextCallback(AddressOf DisableCrewControls)
                       Dim ds As String = "disable"
                       Me.BeginInvoke(d, New Object() {[ds]})

End Sub
Private Sub QfTimer_Tick()
C#
Dim d As New SetTextCallback1(AddressOf DisableQfileControls)
                Dim ds As String = "disable"
                Me.BeginInvoke(d, New Object() {[ds]})

End Sub
Private Sub DisableQfileControls(ByVal param As String)
// reading more than 1000 CSV files
End Sub
Private Sub DisableCrewControls(ByVal param As String)
// reading more than 1000 Excell files
End Sub
End class
---------------------------------------------


Kindly suggest me on it

Thanks in advance.......
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900