Re[2]: Re: New stackless proposal
Lenard Lindstrom <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <Mahogany-0.66.0-4294680211-20040711-202212.00@pop3.norton.antivirus> |
On Sun, 11 Jul 2004 11:24:15 -0700 Mark Hahn <[email protected]> wrote: > > Lenard Lindstrom > > A final comment. Stackless channels have a way to send an > > exception. Will the yield statement do the same? I used it > > when implementing the tasklet generator. > > For my generator I just used the exception that came from trying to > yield to a no-longer-running thread. > > We can still do anything a channel used to do. You can always say > curThreadMgr.method(). For your case it might be > curThreadMgr.throw(exception). > The question is whether or not prothon threads will be preemptive at the byte code level? I do not know if this is the case for Stackless tasklets so assumed they were. If the generator lacks a yield - entirely possible - or fails to call it the thread calling the generator may call its yield before the generator has completed. So the calling thread will wait indefinitely. If the first StopIteration is handled using yield then the calling thread is guaranteed to return. Lenard Lindstrom <[email protected]