Hi everybody,
I'm a little confused about the "--enable-threads" option. The documentation
says that user-created threads will never run without --enable-threads (because
the GIL never gets created) but when I run the following, it works just fine:
a = []
def my_thread(i):
time.sleep(0.5)
for i in xrange(10):
a.append(i)
class application(object):
def __init__(self, environ, start_response):
start_response('200 OK', [])
def __iter__(self):
threads = []
for i in xrange(10):
t = threading.Thread(target=my_thread, args=(i,))
threads.append(t)
for t in threads:
t.start()
yield str(len(a)) + '\n'
for t in threads:
t.join()
yield str(len(a)) + '\n'
Running with command line:
$ uwsgi --plugins=python,http --file ~/path/to/app.py --http :9999
$ curl http://localhost:9999/
0
100
Adding --enable-threads or --threads <n> doesn't change the output.
Is the documentation out of date? Or does using not enabling threads mean
something dangerous could be happening, like threads running without the GIL,
etc?
Thanks
Duncan
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi