In the following code snippet, I'm curious to know more about what is happening.
Assume that this code exists within the OnLoad() method of a Windows Service class and that MyClass is declared within a private property of this windows service class.
MyClass.Process1Method and MyClass.Process1
Dim process1 As System.Threading.Thread
Dim process2 As System.Threading.Thread
Dim ts As System.Threading.ThreadStart
ts = AddressOf MyClass.Process1Method
process1 = New System.Threading.Thread(ts)
process1.Start()
ts = AddressOf MyClass.Process2Method
process2 = New System.Threading.Thread(ts)
process2.Start()
Also assume that Process1Method and Process2Method both access some of the same private properties of MyClass.
So my question is, in case you haven't already guessed, are process1 and process2 threads going to fight over the same property values of MyClass simultaneously? Can you explain how this will behave?
If more clarification is needed I will try my best, Thanks.