[Python-Dev] test_fork1 on SMP? (was Re: [Python Dev] test_fork1 failing --with-threads (for some people)...) (original) (raw)
Guido van Rossum guido@beopen.com
Wed, 09 Aug 2000 17:43:35 -0500
- Previous message: [Python-Dev] test_fork1 on SMP? (was Re: [Python Dev] test_fork1 failing --with-threads (for some people)...)
- Next message: [Python-Dev] [Patch #101135] 'import x as y' and 'from x import y as z' (fwd)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
If I add PyBEGINALLOWTHREADS and PyENDALLOWTHREADS around fork() in posixmodule then the child is the process which always seems to hang.
I first thought that the lock should be released around the fork too, but later I realized that that was exactly wrong: if you release the lock before you fork, another thread will likely grab the lock before you fork; then in the child the lock is held by that other thread but that thread doesn't exist, so when the main thread tries to get the lock back it hangs in the Py_END_ALLOW_THREADS.
--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)
- Previous message: [Python-Dev] test_fork1 on SMP? (was Re: [Python Dev] test_fork1 failing --with-threads (for some people)...)
- Next message: [Python-Dev] [Patch #101135] 'import x as y' and 'from x import y as z' (fwd)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]