Exemplo n.º 1
0
if __name__ == "__main__":
    run_event = threading.Event()
    run_event.set()

    communication = Communication()
    communication.connect()

    # ------------------------------------------------------
    # Run the referee
    main = Main(0, "Main", communication, run_event)

    # ------------------------------------------------------
    # Run the referee
    referee = Referee(1, "Referee", "B", "B", main, run_event)
    referee.connect()
    main.start()
    referee.start()

    try:
        while 1:
            pass
    except KeyboardInterrupt:
        print "attempting to close threads"
        run_event.clear()
        print "run event cleared"

        referee.join()
        print "referee thread closed"

        main.join()