I have a quick question regarding threads and IronPython. I need to code a python function having an input parameter to be the target delegate of a newly created thread using the ThreadStart method to pass the parameter.
Here an example of the code that fails: IronPython 0.9.2036 on .NET 2.0.50215.44 Copyright (c) Microsoft Corporation. All rights reserved. >>> from System import Threading >>> def echo(parm): ... print parm ... >>> td = Threading.Thread(echo) >>> td.Start('test') System.InvalidOperationException: The thread was created with a ThreadStart dele gate that does not accept a parameter. at input_3.Run(Frame frame) >>> Obviously, I need to tell the interpreter that the ThreadStart delegate should take a parameter, but I don't know much about delegates and thus don't how to do it. If i don't use a delegate function with a parameter the ThreadStart works fine.. IronPython 0.9.2036 on .NET 2.0.50215.44 Copyright (c) Microsoft Corporation. All rights reserved. >>> def talk(): ... print 'talking' ... >>> from System.Threading import Thread >>> td = Thread(talk) >>> td.Start() talking >>> Thanks in advanced for any light that you could provide, Anthony _______________________________________________ users-ironpython.com mailing list users-ironpython.com@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com