Blasted! Why is the stackless list headers broken... Forwarding what *SHOULD* have gone to the list in the first place...
On Wed, Dec 9, 2009 at 7:10 PM, Jeremy Stott <[email protected]> wrote: > Hey, > > That sounds pretty clever! How do you allow the timerkeeper to poll once in > a while? > > On Thu, Dec 10, 2009 at 3:06 PM, OvermindDL1 <[email protected]> wrote: >> >> On Wed, Dec 9, 2009 at 5:40 PM, Jeremy Stott <[email protected]> >> wrote: >> > Hello, >> > >> > So far I am loving stackless python! I am totally new to it though and >> > was >> > wondering about having tasklets wait for a certain amount of time. >> > >> > The problem is: >> > I would like to have a tasklet wait for 2 seconds before returning to >> > the >> > scheduling queue, but not delay any other running tasklets. >> > >> > What I have done: >> > timeStart = time.time() >> > >> > while (time.time() < timeStart + 2): >> > stackless.schedule() >> > >> > But this way does waste resources every scheduling cycle. Is there a >> > better >> > way to do this? >> >> I have a tasklet that is designed for such time keeping. I have a >> tasklet send a message to the timekeeper tasklet saying to resume >> itself at the current time + however many milliseconds. The >> timekeeper tasklet polls every once in a while checking for elapsed >> times, and if a time is elapsed, it sends a message to wake that >> tasklet up so it can do whatever, like return itself to the normal >> queue if it wants. It polls just by being in the normal queue, it always runs, and yes it is basically doing the same thing as your >> > while (time.time() < timeStart + 2): >> > stackless.schedule() example, but since it is the *only* one doing it, I can have as many tasklets as I want waiting while it handles all timekeeping. When I add a tasklet to the timekeeper internal queue, just sort it based on time then a simple comparison each loop is perfect. I think the eve demo code had such an example actually now that I think of it. Also, for future note, it is usually not good to top post, here is a good example as to why. :) > A: Yes. > > Q: Are you sure? > >> A: Because it reverses the logical flow of conversation. > >>> Q: Why is top posting annoying in email? > > If you are not convinced that it is wrong by the simple example above, > now try to mix top and bottom posting: > > A: Yes. > > Q: Are you sure? > >>> Q: Why is top posting annoying in email? > >> A: Because it reverses the logical flow of conversation. > > I don't know about you, but that's simply crazy! > > The correct way: > >>> Q: Why is top posting annoying in email? > >> A: Because it reverses the logical flow of conversation. > > Q: Are you sure? > A: Yes. _______________________________________________ Stackless mailing list [email protected] http://www.stackless.com/mailman/listinfo/stackless
