[Stackless] Q2: Uthread's 'Thread' class

Ixokai ixokai at myseraph.org
Fri Apr 13 09:42:12 CEST 2001


"start" process, after it gets a new connection. 'client =
Client(connection)', then it fiddles with the client itself.

    Buuuuut, Thanks for the pointer on the blocking sockets, I know how to
proceed now. :) As for it not being the best topic to learn uthreads with;
You're right, but, i'm stubborn. *grin*

The help was much appreciated.

--Ix

> Ixokai wrote:
>
> > Unfortunately, I still can't quite get it to add new thread objects into
the
> > mix from one which already exists.
> >
> > Stripped code follows; in it, the Client.run() never gets called,
dispite
> > the uthread.new(client.run) in the connection bit of the Server process.
I
> > think i'm just adding new threads the wrong way. :)
>
> I snipped the code, as I didn't even have to try to run it to see that it
> wouldn't work: you didn't instantiate a Client object, only a Server, and
Server
> doesn't have a run() method.
>
> Anyway, thee might be another problem: you're using blocking sockets:
uthreads
> aren't OS threads, so if a socket blocks *all* uthreads will block, so I'm
not
> surprised this doesn't work. You should either use non-blocking sockets
(eg.
> combined with select) or use OS threads... This is not specific to
sockets:
> since uthreads are mostly implemented in Python, *any* call into C might
block
> everything.
>
> I once tried to make a socket wrapper that would work with uthreads, which
used
> a separate uthread containing a select loop. It kindof worked, but I never
> perfected it. If you like I can try to dig it out.
>
> But: to learn about uthreads, try to do simple things first, without
sockets and
> other blocking calls...
>
> Just
> _______________________________________________
> Stackless mailing list
> Stackless at starship.python.net
> http://starship.python.net/mailman/listinfo/stackless
>

_______________________________________________
Stackless mailing list
Stackless at starship.python.net
http://starship.python.net/mailman/listinfo/stackless



More information about the Stackless mailing list