Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Using greenlets in 2 separate threads
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
AM  
View profile  
 More options Oct 31 2012, 12:01 pm
From: AM <ams....@gmail.com>
Date: Wed, 31 Oct 2012 09:01:37 -0700
Local: Wed, Oct 31 2012 12:01 pm
Subject: Re: [gevent] Using greenlets in 2 separate threads
On 10/30/2012 11:25 PM, Viatcheslav Gachkaylo wrote:

> Hello,

> I need to run 2 servers communicating with each other in a single
> process. One uses gevent event loop, the other one uses tornado.
> Now I run the 2nd server in a separate threading.Thread. However I
> wish to use greenlets in the code of this second server. Will this
> cause any troubles?
> What is a simple yet effective alternative in this situation? How hard
> it is to make tornado use gevent and unite the servers' run loops
> together?
> I don't think dividing into 2 different processes with a proper
> communication between them is an appropriate solution.

> The first server is gevent.wsgi.WSGIServer, the second one
> is https://github.com/thisismedium/python-xmpp-server/

> --
> Thank you,
> Viatcheslav Gachkaylo
> Crystalnix

Hi Vitaly.

If you want to run two servers in the same process, simply start the
servers using start (not serve_forever) and wait on the two greenlet
objects you get back. You will have to take care that when one of them
terminates the other one terminates too, or else you may end up with
only one server running.

Re: tornado, it uses its own event loop based around the same apis that
gevent uses but at a much lower level. In theory you might be able to
make it work with greenlets, but you may end up recreating gevent :)

I am wondering why two processes are not a good model?

HTH
AM


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.