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 ...