I didn't mean "the constructor" -- I meant "the ThreadStart routine 
(Worker.StartWorker)."

At 04:06 PM 12/22/2005, I wrote
>And the Worker constructor creates _watcher and _bu?  That certainly seems 
>ok...
>
>At 12:45 PM 12/22/2005, Peter Meinl wrote
>>Sorry, I accidently posted before finishing my message.
>><<<<<<<<
>>
>>Yes, each thread uses its own instance of the VB6 COM+ Component.
>>And I use thread.SetApartmentState(Threading.ApartmentState.STA).
>>
>>In Pseudocode:
>>
>>MyService:
>> OnStart()
>>   For each ...
>>      Dim w As New Worker(folderName)
>>      _workerList.Add(w)
>>      Dim t As New Threading.Thread(AddressOf w.StartWorker)
>>      t.SetApartmentState(Threading.ApartmentState.STA)
>>      t.Start()
>>   Next
>>
>>Class Worker
>>    Private WithEvents _watcher As IO.FileSystemWatcher
>>    Private _bu As MEDAMBusiness.CMilDispatch 'VB6 COM+ component
>>
>>    Private Sub _watcher_Created(ByVal sender As Object, ByVal e As
>>System.IO.FileSystemEventArgs) Handles _watcher.Created
>>        _bu.Dispatch(e.FullPath)
>>    End Sub


J. Merrill / Analytical Software Corp

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to