Author: Maciej Fijalkowski <[email protected]>
Branch:
Changeset: r64546:cb648df8a5fc
Date: 2013-05-24 21:03 +0200
http://bitbucket.org/pypy/pypy/changeset/cb648df8a5fc/
Log: thread safetry fixes
diff --git a/pypy/goal/targetpypystandalone.py
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -124,14 +124,21 @@
@entrypoint('main', [], c_name='pypy_init_threads')
def pypy_init_threads():
- if space.config.objspace.usemodules.thread:
- os_thread.setup_threads(space)
- rffi.aroundstate.before()
+ if not space.config.objspace.usemodules.thread:
+ return
+ os_thread.setup_threads(space)
+ rffi.aroundstate.before()
@entrypoint('main', [], c_name='pypy_thread_attach')
def pypy_thread_attach():
- if space.config.objspace.usemodules.thread:
- rthread.gc_thread_start()
+ if not space.config.objspace.usemodules.thread:
+ return
+ os_thread.setup_threads(space)
+ os_thread.bootstrapper.acquire(space, None, None)
+ rthread.gc_thread_start()
+ os_thread.bootstrapper.nbthreads += 1
+ os_thread.bootstrapper.release()
+ rffi.aroundstate.before()
w_globals = space.newdict()
space.setitem(w_globals, space.wrap('__builtins__'),
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit