[Stackless] Connecting To A Database

Edward Faulkner ef at alum.mit.edu
Mon Jun 11 18:08:14 CEST 2007


There's an awful lot of confusion here around IO in stackless.  It's
really very simple, because it works the same as asynchronous IO
always works.  If you've never built a program based on "select" or
"poll", go learn how to do that first, and then worry about how you
can use stackless to make it prettier.

Just a general sketch: you end up with one "master IO tasklet" that
does all the actual syscalls for polling and sleeping (being careful
to sleep only when no other tasklet has anything to do), and all the
other tasklets communicate with the master via channels.   The nice
thing about stackless is that you can make this communication very
seamless, and write all the tasklets as if they were really doing
their own IO.

The stackless socket module that's floating around serves as a good
introduction, but you really don't want to build a real production
program around it.  In particular, you should probably handle both
sleeping and polling together within a single tasklet.  It's the only
way to avoid busy loops.

regards,
Ed

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list