Communicating between threads
Aahz Maruch
aahz at panix.com
Sun Sep 30 14:04:31 EDT 2001
In article <mailman.1001703330.1355.python-list at python.org>,
<fladak at rri.on.ca> wrote:
>
>Does anyone know how to communicate between threads? It might help if I
>explained my application.
It sound like you have two processes, each with two threads. That
complicates things a bit.
>I have two instances of an application, written in python, running.
>I refer to the application as a "viewer". Both instances have two
>threads. The main thread (I'll refer to it as thread A) handles
>the GUI events and the other thread (I'll refer to it as thread B)
>communicates to the other viewer using OmniOrb, an implementation of
>CORBA. I'm trying to develop the code so that if you rotate the image
>in one viewer, the image in the other viewer rotates.
>
>When I rotate the image in viewer 1, thread A in viewer 1 communicates
>to thread B in viewer 2 and requests a rotation. Since thread A
>handles all the GUI events, I need some way to communicate this from
>thread B in viewer 2 to thread A in viewer 2.
For starters, take a look at http://starship.python.net/crew/aahz/ for
some sample code for dealing with GUIs. It sounds like you either need
to have thread A being a CORBA client talking to thread B of the second
process (simplest solution, but potentially blocking) or create a third
thread to act as the CORBA client. In either case, thread B as the
CORBA server talks to thread A in its own process by either manipulating
variables directly or by passing data in a Queue.
--
--- Aahz <*> (Copyright 2001 by aahz at pobox.com)
Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista
We must not let the evil of a few trample the freedoms of the many.
More information about the Python-list
mailing list