[Stackless] Q2: Uthread's 'Thread' class
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.
> Ixokai wrote:
> > Unfortunately, I still can't quite get it to add new thread objects into
> > mix from one which already exists.
> > Stripped code follows; in it, the Client.run() never gets called,
> > the uthread.new(client.run) in the connection bit of the Server process.
> > 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
> doesn't have a run() method.
> Anyway, thee might be another problem: you're using blocking sockets:
> aren't OS threads, so if a socket blocks *all* uthreads will block, so I'm
> surprised this doesn't work. You should either use non-blocking sockets
> combined with select) or use OS threads... This is not specific to
> since uthreads are mostly implemented in Python, *any* call into C might
> I once tried to make a socket wrapper that would work with uthreads, which
> 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
> other blocking calls...
> Stackless mailing list
> Stackless at starship.python.net
Stackless mailing list
Stackless at starship.python.net
More information about the Stackless