R
ryan
Hi,
I've omitted a large chunk of the code for clarity but the loop below is how
I'm calling a delegate function asynchronously. After I start the each call
I'm incrementing a counter and then making the main thread sleep until the
counter gets back to zero. The call back function for each call decrements
the counter. Is there a better way to make the thread wait until all calls
are complete besides using the counter? I've seen some things with using an
IAsyncResult but I'm not sure how to do that in my case since I'm making 1
to n calls.
Thanks,
Ryan
For iProviderIndex As Int32 = 0 To oProviders.Length - 1
oLookupReq = New Schema.LookupRequest
oLookup =
CType(Activator.CreateInstance(Type.GetType(oLookupType.class_id)),
Schema.IPrequalLookup)
Del = New LookupAsyncDelegate(AddressOf oLookup.GetPrequalResponse)
Del.BeginInvoke(oLookupReq, AddressOf LookupCallback, Del)
IncrementAsyncOps()
Next iProviderIndex
While m_async_ops > 0
Thread.Sleep(200)
End While
I've omitted a large chunk of the code for clarity but the loop below is how
I'm calling a delegate function asynchronously. After I start the each call
I'm incrementing a counter and then making the main thread sleep until the
counter gets back to zero. The call back function for each call decrements
the counter. Is there a better way to make the thread wait until all calls
are complete besides using the counter? I've seen some things with using an
IAsyncResult but I'm not sure how to do that in my case since I'm making 1
to n calls.
Thanks,
Ryan
For iProviderIndex As Int32 = 0 To oProviders.Length - 1
oLookupReq = New Schema.LookupRequest
oLookup =
CType(Activator.CreateInstance(Type.GetType(oLookupType.class_id)),
Schema.IPrequalLookup)
Del = New LookupAsyncDelegate(AddressOf oLookup.GetPrequalResponse)
Del.BeginInvoke(oLookupReq, AddressOf LookupCallback, Del)
IncrementAsyncOps()
Next iProviderIndex
While m_async_ops > 0
Thread.Sleep(200)
End While