Re: Re[2]: Re: New stackless proposal
"Mark Hahn" <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <007b01c467cf$93849f50$0d01a8c0@MarkVaio> |
Lenard Lindstrom wrote: > 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. Even if the calling thread has already hit its yield it can still get an exception and leave the yield. There is no difference before and after getting to the yield. You are saying there is a race but you are wrong. > If the first StopIteration > is handled using yield then the calling thread is guaranteed to > return. I don't understand what situation could cause the calling thread to not return. Ultimately the generator thread must hit a yield or terminate. So it will either yield a value or cause an exception. There is no third possibility.