Multithreading using the same subroutine in different threads
Hi Mumbles,
Let me just say thank you for a really clear introduction to VB for the API.
I've written an application which runs very smoothly (I need it to be very quick because I use it to trade in-play), because I've put all the different calls to the Betfair server on separate threads.
I want to expand the application to incorporate several Betfair markets simultaneously, which, if I am to make it as fast as possible, will have to call the same subroutine in different threads. For instance, I may want to create two threads which make separate calls on my subroutine:
Sub GetPrices(ByVal MktId As Integer)
.
' Puts the market prices/amounts into an array which is used to display the data on the form (in a different call of the application)
.
End Sub
Is this possible, or will the data in the two separate threads get confused?
Of course, I could just create a new subroutine for each different market I want to access (so my application would contains Subs GetPrices1, GetPrices2, etc. . ) but this is not a very elegant solution.
Thanks.
Hi Mumbles,
Let me just say thank you for a really clear introduction to VB for the API.
I've written an application which runs very smoothly (I need it to be very quick because I use it to trade in-play), because I've put all the different calls to the Betfair server on separate threads.
I want to expand the application to incorporate several Betfair markets simultaneously, which, if I am to make it as fast as possible, will have to call the same subroutine in different threads. For instance, I may want to create two threads which make separate calls on my subroutine:
Sub GetPrices(ByVal MktId As Integer)
.
' Puts the market prices/amounts into an array which is used to display the data on the form (in a different call of the application)
.
End Sub
Is this possible, or will the data in the two separate threads get confused?
Of course, I could just create a new subroutine for each different market I want to access (so my application would contains Subs GetPrices1, GetPrices2, etc. . ) but this is not a very elegant solution.
Thanks.



Comment