Windows Service

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've created a Windows Service in VB.NET which globally holds an array of
threads. Every second, it loops through the threads, and if any of the
threads are set to Nothing, and I have an available job in a DataTable it
spawns a new thread. When a thread is complete, it raises an event that
resets the Thread to Nothing.

The Windows service starts correctly, but the threads never start. The code
is as follows:

For i As Integer = 0 To Threads.Length - 1
If (Threads(i) Is Nothing) Then
Dim dr() As DataRow = Jobs.Select("Complete=''")
If (dr.Length > 0) Then
Dim a As New Threader
a.Dest = "C:\Output\"
a.dr = dr(0)
a.ThreadInstance = i
AddHandler a.ThreadComplete, AddressOf TC
Threads(i) = New System.Threading.Thread(AddressOf
a.Convert)
Threads(i).Start()
dr(0)("Complete") = "Running"
End If
End If
Next

I'm using VS.NET 2003 and .NET 1.1.
 
Back
Top