Bi-directional sub-process communication

Israel Brewster israel at ravnalaska.net
Mon Nov 23 19:27:39 EST 2015


On Nov 23, 2015, at 3:05 PM, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> 
> On Mon, 23 Nov 2015 08:54:38 -0900, Israel Brewster <israel at ravnalaska.net>
> declaimed the following:
> 
>> Concern: Since the master process is multi-threaded, it seems likely enough that multiple threads on the master side would make requests at the same time. I understand that the Queue class has locks that make
> 
> 	Multiple "master" threads, to me, means you do NOT have a "master
> process".

But I do: the CherryPy "application", which has multiple threads - one per request (and perhaps a few more) to be exact. It's these request threads that generate the calls to the child process.

> 
> 	Let there be a Queue for EVERY LISTENER.
> 
> 	Send the Queue as part of the request packet.

No luck: "RuntimeError: Queue objects should only be shared between processes through inheritance"

This IS a master process, with multiple threads, trying to communicate with a child process. That said, with some modifications this sort of approach could still work.

-----------------------------------------------
Israel Brewster
Systems Analyst II
Ravn Alaska
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7293
-----------------------------------------------


> 
> 	Let the subthread reply to the queue that was provided via the packet
> 
> 	Voila! No intermixing of "master/slave" interaction; each slave only
> replies to the master that sent it a command; each master only receives
> replies from slaves it has commanded. Slaves can still be shared, as they
> are given the information of which master they need to speak with.
> 
> 	
> 
> -- 
> 	Wulfraed                 Dennis Lee Bieber         AF6VN
>    wlfraed at ix.netcom.com    HTTP://wlfraed.home.netcom.com/
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list