[IronPython] function thread target delegates

Keith J. Farmer kfarmer at thuban.org
Sat Aug 6 20:25:44 CEST 2005


Okay, had a brief check.  You should take a look at delegates.  They're
not the same as passing around Python methods.  In particular, they're
typed.
The type of a delegate is its signature.  In particular:
ThreadStart -> void foo()
ParameterizedThreadStart -> void foo(object)
The Thread constructor you're picking up is Thread(ThreadStart foo),
where you want Thread(ParameterizedThreadStart foo).
What you want, somehow, is to get the overload to pick the
ParameterizedThreadStart version.
However, the following seems to encounter a conflict between generics
and method resolution:
>>> t = Threading.Thread[Threading.ParameterizedThreadStart](echo)
System.InvalidOperationException: System.Threading.Thread is not a
GenericTypeDefinition. MakeGenericType may only be called on a type for
which Type.IsGenericTypeDefinition is true.
   at System.RuntimeType.MakeGenericType(Type[] instantiation, Boolean
verify)
   at input_11.Run(Frame frame)

-----
Keith J. Farmer
kfarmer at thuban.org



More information about the Ironpython-users mailing list