asyncore, asynchat and threads

Joshua Moore-Oliva josh at chatgris.com
Wed Aug 4 13:36:32 EDT 2004


Well, I took at look at twisted..  and it seems pretty scary ;)

What I've done though is made some very minor changes to asyncore and asynchat, and now it appears to be threadsafe//more controllable.

If all works out well for me I'll submit the patch to python, since it's fully backwards compatbile with the old behaviour.

Thanks for the help

Joshua Moore-Oliva

On August 4, 2004 08:10 am, Peter Hansen wrote:
> Joshua Moore-Oliva wrote:
> 
> > I have to not return any data until there is data to 
>  > return for that specific connection.  If there is some
>  > way to send data down a asynchat
> > socket from another thread (thread-safely), or to 
>  > somehow wake up an asynchat class, that would be great.
> 
> It's been years since I used asyncore (I find Twisted much
> simpler to use) but at least in theory such a thing is
> possible.  Twisted has a callFromThread() method that can
> be used to get a callback in another thread to be called
> from the "reactor" (the equivalent of the asyncore core
> loop), which would do what you want.  Asyncore might have
> similar facilities.
> 
> I don't _fully_ grasp what you are doing, and I don't work
> well without pictures in such cases (got a whiteboard handy?
> draw a picture and send me a digital photo :-), but so
> far it doesn't sound like you have anything approaching
> unusual, compared to many other applications I've seen doing
> the sorts of things yours seems to be doing.
> 
> -Peter



More information about the Python-list mailing list