Updating <Tutorials.ThreadFunc>
We are no longer performing the processing in the class ThreadFunc. However, we will still use it to create the instances of the FileWorker class, set the options, and start the processing. If we don’t, we could cause <OnStart> to take too long to complete and return control to the service control manager (SCM). Again, it is never a good idea to tie up the <OnStart> method. Example 4-21 shows the modifications required to our <ThreadFunc> method to support the new multi-file processing capabilities.
Example 4-21. Updated Tutorials.ThreadFunc.
Private Sub ThreadFunc() Try Dim tmpOptions(5) As FileWorkerOptions Dim iLoop As Short Dim tmpWorker As FileWorker For iLoop = 0 To 4 tmpOptions(iLoop) = New FileWorkerOptions ...
Get Programming Windows® Services with Microsoft® Visual Basic® 2008 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.