I am trying to wrap my head around threads.
I have a recursive method that displays directory paths in a multiline text box. The directory structure is very large, about 20000 folders up to around 20 levels deep on some branches.
I have been getting a ContextSwitchingDeadlock error from time to time. I understand that this error can be supressed via a setting (somewhere) in VS2005. I though it would be better to run my recursive method on it's own thread instead of supressing the message??
My method (GetTree) accepts one parameter, a start directory. I've been trying to declare the tread as follows,
Dim t As New Thread(New ThreadStart(AddressOf Me.GetTree(StartDir)))
But this gives me the error "AddressOf operand must be the name of the method without parentheses"
If I try the same thing using another method that takes no arguments it's no problem.
What am I doing wrong?
I have a recursive method that displays directory paths in a multiline text box. The directory structure is very large, about 20000 folders up to around 20 levels deep on some branches.
I have been getting a ContextSwitchingDeadlock error from time to time. I understand that this error can be supressed via a setting (somewhere) in VS2005. I though it would be better to run my recursive method on it's own thread instead of supressing the message??
My method (GetTree) accepts one parameter, a start directory. I've been trying to declare the tread as follows,
Dim t As New Thread(New ThreadStart(AddressOf Me.GetTree(StartDir)))
But this gives me the error "AddressOf operand must be the name of the method without parentheses"
If I try the same thing using another method that takes no arguments it's no problem.
What am I doing wrong?