示例#1
0
def print_message(*args, **kwargs):
    print "Example function1", args, kwargs


@subscribe("Hello2")
def print_message2(*args, **kwargs):
    import time
    time.sleep(4)
    print "Example function2", args, kwargs


@subscribe("STOP")
def dead_mainthread(*args, **kwargs):
    print "dead MainThread!"


def other_example(*args, **kwargs):
    print "manual subscribe"


send_thread("Hello1", text_example="new thread")

send_queue("Hello2", text_example="normal run")
send("Hello2", text_example="normal run")

add_subscribe("Hello3", other_example)
send_blocking("Hello3", text_example="blocking")

print "Finish send all events"
print "waiting stop"
示例#2
0
 def test_send_queue(self):
     # add to queue signals (non-blocking)
     send_queue("pepito", 1, 2, 3, example="added queue")
     self.assertEqual(True, True)