Click here to Skip to main content
11,702,396 members (68,546 online)
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 20:28pm
wujapan624

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

  Print Answers RSS
0 Maciej Los 515
1 Sergey Alexandrovich Kryukov 355
2 OriginalGriff 299
3 CHill60 145
4 Mika Wendelius 115
0 OriginalGriff 8,369
1 Sergey Alexandrovich Kryukov 7,547
2 CPallini 4,922
3 Maciej Los 4,411
4 Mika Wendelius 3,556


Advertise | Privacy | Mobile
Web03 | 2.8.150819.1 | Last Updated 31 May 2013
Copyright © CodeProject, 1999-2015
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