Hi, Python Folks

Discussion in 'Python' started by aonlazio, Aug 9, 2008.

  1. aonlazio

    aonlazio Guest

    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.
    aonlazio, Aug 9, 2008
    1. Advertisements

  2. aonlazio

    schaffe Guest

    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.

    schaffe, Aug 9, 2008
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.