Re: threads vs. greenlets (was Re: New stacklessproposal)
"Mark Hahn" <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
Mark Hahn wrote: > I understand what you are saying now. You want only co-routines on > the Thread layer and functions like Sleep on the OSThread layer, > correct? > > Do you included pre-emption as something that should be only on the > OSThread layer? > > Now that I really understand what you are asking for I will give it > some thought. > > Sleep could be avoided by the programmer just by not using it. We > could maybe make pre-emption a tuning parameter. It could be turned > on or off and the granularity could be fine-tuned. > > I'm going to stop this response here because we really have two > different discussions going on. One is threads vs. greenlets and the > other is implementation. Christian: You never responded to this. Would it be ok to have pre-emption and sleep in the tasklets if we made the pre-emption tunable by parameters in the ThreadMgr? The user could turn off pre-emption by setting the granularity to infinity and could avoid using sleep(). This would give them the simple non-thread tasklets you want to provide. We could make this the default setting. Calling sleep() with pre-emption turned off could throw an exception. So in the default case sleep would throw an exception also. If you agree with this then I think we finally agree on everything and I can rewrite the proposal.