Hi, Python Folks

A

aonlazio

I have a question.
If I have, say object A and object B and function C. Then, I set
object B to do some stuff only if object A receives a certain message
while my program continues running function C. Suddenly, object A
receives the message (and supposedly object B should be triggered to
do the stuff) . From this point, how can I set my program to go back
to run object B stuff while it is running function C and when it
finishes that object B task it come back to run function C. (like
interrupting somehow).
Thanks in advance.
 
S

schaffe

I have a question.
     If I have, say object A and object B and function C. Then, I set
object B to do some stuff only if object A receives a certain message
while my program continues running function C. Suddenly, object A
receives the message (and supposedly object B should be triggered to
do the stuff) . From this point, how can I set my program to go back
to run object B stuff while it is running function C and when it
finishes that object B task it come back to run function C. (like
interrupting somehow).
    Thanks in advance.

Im thinking you could use threads and the Event-handler avaiable.
Then you check for certain signals/interrupts peridocially and when
you recive the signal you communicate the the object thread A that it
should wait for a certain Event that object thread B will set when its
done. If i havent missunderstood your concept i think it wouldnt be
that complicated to solve with threads, check
http://code.activestate.com/recipes/langs/python/tags/threads/ for
good examples how to program threads.

Br
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,169
Latest member
ArturoOlne
Top