[Tutor] threads

Bill Mill bill.mill at gmail.com
Fri Feb 25 18:04:42 CET 2005


Hi Hugo,

<snip>
> I tried my hands at Stackless too... but still had
> problems implementing the concept.
> 
> Can anyone guide me on how to spawn simultaneously( or
> pseudo simultaneously) running microthreads using
> stackless.
> 
> Here is what i tried..
> 
> ef gencars(num,origin,dest,speed):
>     global adjls
>     global cars
>     global juncls
>     for i in range(num):
> 
>              cars.append(car(orig,dest,speed)
>              task=tasklet(cars[i].run())
>              task.setup('Bind using Setup')
> 
> Now this is what i copied from somewhere...i dont
> claim to understand fully what is happening.Here
> car.run() is a process which takes a long time to
> execute.
> 
> What happens on execution is....One car is initialised
> and then the program waits for its run method to
> complete before proceeding.
> 
> I also feel that there is no clear documentation on
> stackless.
> 
> Show me the light.
> 

You might want to tighten this question up and ask it on python-list.
This is pretty specialized knowledge for the python-tutors list, and I
know for a fact that there are several people who have used greenlets
on python-list.

Just a thought.

Peace
Bill Mill
bill.mill at gmail.com


More information about the Tutor mailing list