views:

120

answers:

2

Hello,

I have questions about System.Threading.ThreadStart Class :

thanks

+1  A: 

1) ThreadStart is a delegate, not a class. It is a variable that holds a pointer to a method. In this case, it is any method that takes no parameters and returns no variable. So you can do something like this:

private void SomeMethod() {}

public void StartThreadingLol()
{
  var thread = new Thread(SomeMethod);
}

2) Whatever field that is it doesn't have anything to do with you as a .NET programmer. Why do you think you need it?

Will
_methodPtrAux is the address of the method the delegate points to, correct ? (in your example, the address of SomeMethod()).
Thomas
@Thomas Ignore the man behind the curtain.
Will
Well no, because I am studying the internals of .NET
Thomas
@Thomas makes more sense.
Will
+1  A: 

Well, if you got ROTOR, you should have been able to answer at least one of your questions:

    // In the case of a static method passed to a delegate, this field stores
    // whatever _methodPtr would have stored: and _methodPtr points to a
    // small thunk which removes the "this" pointer before going on
    // to _methodPtrAux.
    internal IntPtr _methodPtrAux;
Damien_The_Unbeliever
Yes that's right ! I had searched in ThreadStart.cs only...
Thomas