[Stackless] First stackless nonblocking file IO tests....

Carlos Eduardo de Paula carlosedp at gmail.com
Thu Apr 26 23:54:14 CEST 2007


I think I fixed it having a tasklet to manage the callback... here
follows the last version. As soon as I finish some tests and put the
other file methods I will commit it to the SVN.

http://dpaste.com/hold/9124/

Carlos

On 4/26/07, Carlos Eduardo de Paula <carlosedp at gmail.com> wrote:
> One problem I found out is that in my example, I fire multiple
> tasklets to start a file copy. They all call the read/write functions
> which are fired to the threadpool and gets blocked on a channel. When
> the thread finish the operation, it does a ch.send(data) back to the
> tasklet. The problem is that some tasklets doesnt finishes the
> operation because the current existing tasklets are all blocked on a
> channel, with this the scheduler finishes.
>
> If I create a tasklet to do nothing but run, this problem dont happen.
> To check this put a print "Start %s" % stackless.getcurrent() and a
> print "Finish %s" % stackless.getcurrent()" at the start and the end
> of the copyfile function. All tasklets start but not all of them
> "finishes"...
>
> Any idea on how to deal with this?
>
> Carlos
>
> On 4/25/07, Carlos Eduardo de Paula <carlosedp at gmail.com> wrote:
> > For now this only implements read() and write() .. do you think this
> > is a problem? I found this way better because the other functions are
> > not noticeably blocking like read and write...
> >
> > I´m gonna take another look at it and then gonna check in the SVN.
> >
> > If someone found any issue on this, please let me know...
> >
> > Carlos
> >
> > On 4/25/07, Richard Tew <richard.m.tew at gmail.com> wrote:
> > > On 4/24/07, Carlos Eduardo de Paula <carlosedp at gmail.com> wrote:
> > > > Based on an idea used in some async frameworks like tiwsted, I created
> > > > a concept for having nonblocking file IO access for tasklets.
> > > >
> > > > The idea is based on creating a threadpool and handling the IO
> > > > requests to it, it has been based on a recipe from ASPN cookbook.
> > > >
> > > > Here follows the module and an example with the monkeypatching. If
> > > > anyone can check it and point out the flaws on this approach I would
> > > > be glad since this is my first shot on this.
> > >
> > > Looks really good Carlos.  It is a nice accompanyment to the
> > > socket module.
> > >
> > > You should definitely check it into the examples SVN :-)
> > >
> > > Cheers,
> > > Richard.
> > >
> >
> >
> > --
> > -------------------------------------------------------------------
> > Visit Stackless Examples Project
> > http://code.google.com/p/stacklessexamples/
> > Stackless Python - www.stackless.com
> > -------------------------------------------------------------------
> >
>
>
> --
> -------------------------------------------------------------------
> Visit Stackless Examples Project
> http://code.google.com/p/stacklessexamples/
> Stackless Python - www.stackless.com
> -------------------------------------------------------------------
>


-- 
-------------------------------------------------------------------
Visit Stackless Examples Project
http://code.google.com/p/stacklessexamples/
Stackless Python - www.stackless.com
-------------------------------------------------------------------

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



More information about the Stackless mailing list