Click here to Skip to main content
13,049,814 members (75,814 online)
Rate this:
Please Sign up or sign in to vote.
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

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

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
End sub
Private Sub CrTimer_Tick()
Dim d As New SetTextCallback(AddressOf DisableCrewControls)
                       Dim ds As String = "disable"
                       Me.BeginInvoke(d, New Object() {[ds]})

End Sub
Private Sub QfTimer_Tick()
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 30-May-13 20:28pm

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 31 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100