[Stackless] http server experiment

Christian Tismer tismer at tismer.com
Sat Aug 24 21:21:04 CEST 2002


Aaron Watters wrote:
...
About the atomic randrange and friends:

At the moment, they are in fact not necessary, since
we don't have auto-scheduling yet, and it will take some
time until we have it. The reason is that certain extensions
call back into Python and assume to be not scheduled meanwhile.
PythonWin and Scintilla is an example. If you use free scheduling
(which is internally implemented) and happen to print something
while something else is printed, you will crash Scintilla.

For that reason I will buil a mechanism in that prevends
auto-schedules by default and only allows it for certain,
known contexts.
There is already a protection object for providing you
own schedule locking for you own, auto-schedule enabled
code. Tasklets have an atomic flag which has to be obeyed by 
auto-schedulers. There is also an atomic object that prevends
you from forgetting the flag:

def atomicRandRange(start, end, step=1):
     tmp = stackless.atomic()
     return random.randrange(start, end, step)

(this would only apply if random would be one of the modules
which are allowed for auto-schedule, which I gues would *not*
be done).

The trick with atomic is that it sets the current tasklet's
atomic flag and restores it at its own deallocation, that
is, when the frame returns. It will turn out whether this
is useful, later...

ciao - chris
-- 
Christian Tismer             :^)   <mailto:tismer at tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/



-- 
http://mail.python.org/mailman/listinfo/python-list



More information about the Stackless mailing list