Thread, give me the parameter!!!
How can I set the initial parameters of a thread? For example:
VB Code:
private sub eheheheh()
param1=0
param2=4
Dim x As New Threading.Thread(AddressOf DoOperation)
x.Start()
end sub
Private sub DoOperation
Result=param1+param2
'Do your stuff...
end sub
Notice that I don't want to wait for this operation to finish, I want only to set the initial parameters of the thread. And I don't want to use local variables because sub eheheheh can be called several times...
Any ideas?
Thx,
Xmas79
Re: Thread, give me the parameter!!!
Quote:
Originally posted by Xmas79
... I want only to set the initial parameters of the thread. And I don't want to use local variables because sub eheheheh can be called several times...
The above code uses local variables, and it's not good, as this code can be executed several times. There's a chance to get these parameters changed by a "second" thread while the "first" is being executed...
Any other suggestions?
Thx