Adam,
Thanks for your advice!
Yes, I have noticed in my app that the use of System.Threading.Timers is
very resource intensive especially when I have to constantly poll a scanner
to read in docs. I have implemented other approaches like the use of form
timers, etc but still the same problem. I am able to implement async timers
to my scanner routine but I am stuck in one simple area which I cannot
resolve without the use of threading timers. Consider the following code:
Sub AsyncCallBack()
Dim objAsyncDel As New AsyncPollScanDelegate(AddressOf RunThirdThread_proc)
Dim objAsync As New AsyncCallback(AddressOf MyCallBackThreadPoolRoutine)
Dim objAR As IAsyncResult
objAR = objAsyncDel.BeginInvoke(objAsync, Nothing)
Do Until objAR.IsCompleted
'Do processing stuff
Loop
'objAsyncDel.EndInvoke(objAR)
End Sub
As you can see this will execute once and complete but how to I have the
program execute in an infinite loop without the use of timers?? The objAR
delegate will return IsCompleted and this routine will complete. For me to
implement a periodic polling technique is there another approach to above
without the use of threading timers?
Also, you mentioned ThreadPool threads. My app not only has to scan in
documents, but it has to process the documents by executing another program
to crop, despeckle, etc...and to produce thumbnail images of the scanned
images. The original programmer split up the processing into 4 main routines
(in VB6) which I implemented into 4 threadpool threads for my conversion to
VB.NET. Architecturally speaking, do you feel it is more efficient to split
these 4 threadpool threads into 4 async delegates instead??
Thanks!
Viet