Keith,
Thanks for your insight and reply.
I found that it works if instead of using generics, I just wrapped the
function as an ParameterizedThreadStart instance.. Take a look:
Anthony
IronPython 0.9.2036 on .NET 2.0.50215.44
Copyright (c) Microsoft Corporation. All rights reserved.
>>> from System import Threading
>>> def echo(arg):
... print arg
...
>>> t = Threading.Thread(Threading.ParameterizedThreadStart(echo))
>>> t.Start('hi')
>>> hi
()
>>>
On 8/6/05, Keith J. Farmer <[EMAIL PROTECTED]> wrote:
> 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
> [EMAIL PROTECTED]
> _______________________________________________
> users-ironpython.com mailing list
> [email protected]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
_______________________________________________
users-ironpython.com mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com