summaryrefslogtreecommitdiff
path: root/tests/sleepthreadasync.py
blob: 5795099f84c5efc8d2e9066f67d0edcc099bee10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import uwsgi
import threading
import time


def foo():
    while True:
        time.sleep(1)
        print "ciao, sono un thread"

t = threading.Thread(target=foo)
t.daemon = True
t.start()


def application(e, s):
    s('200 OK', [('Content-Type', 'text/html')])
    for i in range(0, 3):
        yield uwsgi.async_sleep(1)
        yield "iter: %d<br/>" % i