[IronPython] Making asynchronous calls in IronPython
glenn.schmottlach at harman.com
Mon May 4 14:01:29 PDT 2009
I've looked at the C# examples in MSDN but they don't appear to lend
themselves (at least with my limited experience in .NET) to an easy
implementation in IronPython due to the dynamic nature of the type
system in Python.
The example I looked at:
declares a delegate type which seems difficult to do in IronPython, e.g.
public delegate bool AsyncFactorCaller (
ref int primefactor1,
ref int primefactor2);
So what's the equivalent in IronPython?
Also, (out) parameters are passed by reference to BeginInvoke and
EndInvoke and it's not clear to me how to handle this in IronPython.
So, I suspect I'm missing something in order to get things working. What
I really need to see is a concrete IronPython example and I think things
would gel at that point. Could you offer such an example . . . Google
hasn't been helpful in this respect.
From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
Sent: Monday, May 04, 2009 4:33 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Making asynchronous calls in IronPython
Schmottlach, Glenn wrote:
> Although I'm very comfortable with CPython, I'm new to IronPython and
> the .NET framework. What I am looking for is sample code that shows
> how to issue an asynchronous call from IronPython using the
> BeginInvoke/EndInvoke mechanism of .NET.
I can't remember the usage off the top of my head - but usage from
IronPython is identical to usage from C#, so an MSDN example ought to
give you what you need.
All the best,
> Currently, I'm playing around with GTK# and a D-Bus .NET
> implementation (NDesk-DBus) that only provides synchronous proxy
> methods for D-Bus services. I believe (please correct me if I'm wrong)
> that I should be able to use the BeginInvoke/EndInvoke mechanism to
> issue these blocking proxy requests asynchronously and be notified
> (via a callback) when the method has completed.
> My blocking proxy calls look something like this:
> ret = /self/._proxy.TunerGetCurrentWaveBand(0)
> where 'ret' returns the current waveband (AM, FM, etc..) and are
> called from a button "clicked" delegate. I would rather not block the
> GTK# dispatch loop while waiting for the reply from the service. Can
> someone offer me any advice or provide a reference to sample code that
> illustrates the basic concept from IronPython?
> Users mailing list
> Users at lists.ironpython.com
Users mailing list
Users at lists.ironpython.com
More information about the Users