Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Asynchronous
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
QfTimer.Start()
CrTimer.Start()
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 21:28pm
wujapan618

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

  Print Answers RSS
0 OriginalGriff 6,769
1 Sergey Alexandrovich Kryukov 6,338
2 DamithSL 5,408
3 Manas Bhardwaj 4,816
4 Maciej Los 4,195


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 31 May 2013
Copyright © CodeProject, 1999-2014
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