|
-
Feb 25th, 2008, 06:37 AM
#1
Thread Starter
New Member
MultiThreading in vb6
I have a collection object which contains filenames of the xml file to be parsed.I need to maintain a thread pool with 5 threads and assign the filenames to the parser threads...Can anyone tell me how I can do this? Currently I am using createObject to create parserthreads and then storing the referance in an array.
*************************
dim mlNrTrunks as integer
mlNrTrunks = 5
For lInstance = 1 To mlNrTrunks
On Error GoTo Failed
Set MyThreadArray(lInstance) = CreateObject("MyThreads")
GoTo Done
Failed:
Call Log("Thread creation failed " & Err.Number & " " & Err.Source & " " & Err.description, lInstance)
Exit Sub
Done:
Next lInstance
**********************************
Then I am calling the parse function
***************************************
lInstance =0
Do While filename <> "_END"
If Not MyThreadArray(lInstance).IsBusy Then
MyThreadArray(lInstance).executeTestcase filename
filename = getNextTestCase
End If
Sleep (1)
lInstance = lInstance + 1
If lInstance = mlNrTrunks + 1 Then
lInstance = 1
End If
Loop
********************
getNextTestCase returns the next filename from the collection
Issue:
executeTestcase is blocking...I want this call to be non blocking...I was just wondering if this can be done using non-blocking raiseEvent...First of all I am not sure if non-blocking RaiseEvent is possible in VB6....Can anyone help me plzzzzzzz
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|