Greenlets: where are they now???
John Lenton
john at grulic.org.ar
Tue Sep 14 09:03:51 EDT 2004
On Mon, Sep 13, 2004 at 08:12:07PM -0700, David Pokorny wrote:
>
> "Peter Hansen" <peter at engcorp.com> wrote in message
> news:29Cdnar3ZOqUFtjcRVn-pg at powergate.ca...
> > > Greenlets are about 90% of a solution (which I've thought hard about) to
> the
> > > problem of interrupting an execution after 50 byte-code, while retaining
> the
> > > ability to resume the execution (for, say, another 50 byte codes).
> >
> > Python's regular threads already allow this, so there must be
> > something more to it.
>
> I haven't the faintest idea how to gain fine control over threads. In
> particular, suppose I have 10 of these "executions" going (lets call them
> "steplets") and I want to run each of them for 50 byte-codes, then switch
> back to the controlling thread and do lots of bookkeeping (I don't control
> the code that the steplets run). I also have a bunch of other processes that
> I don't want to take part in this "cycle rationing" but rather run as honest
> threads.
wouldn't calling setcheckinterval with some ridiculously large
argument on entering the loop and setting it back to 100 (or 50) on
exit be enough?
--
John Lenton (john at grulic.org.ar) -- Random fortune:
Q: How many Marxists does it take to screw in a light bulb?
A: None: The light bulb contains the seeds of its own revolution.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20040914/c7b48b78/attachment.sig>
More information about the Python-list
mailing list