Charles-Francois Natali <neolo...@free.fr> added the comment:

> Ah, using the fallback implementation of tls?  Surely this isn't a 
> problem with the pthreads tls, I'd be surprised if it retains TLS values 
> after fork.

It surprised me too when I found that out, but it's really with the pthread 
TLS, on RHEL 4 and 5 (fixed in RHEL6).
See the attached test_specific.c test script.

> You could add a new _PyGILState_ReInit() function and call it from
> PyOS_AfterFork() or PyEval_ReInitThreads().

See attached tls_reinit.diff patch.
But I really find this redundant with PyThread_ReInitTLS, because what we're 
really doing is reinit the TLS.
Also, this calls this for every thread implementation, while it's only 
necessary for pthreads (and for other implementation it will redo the work done 
by PyThread_ReInitTLS).
So I've written another patch which does this in pthread's PyThread_ReInitTLS.

You've got much more experience than me, so it's really your call.
Actually, I kind of feel bad for adding such a hack for a pthread's bug 
affecting only RHEL 4 and 5, I'm wondering whether it's really worth fixing it.

----------
Added file: http://bugs.python.org/file21801/tls_reinit.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10517>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to