[Python-Dev] pthreads, fork, import, and execvp
"Martin v. Löwis"
martin at v.loewis.de
Tue May 16 23:13:29 CEST 2006
Rotem Yaari wrote:
>> Rotem should simply avoid to fork() in the toplevel code of a module.
>>
>
> That's exactly the problem - the fork is not done at the module level,
> and the reason for the deadlock is imports inside functions performed
> by various library functions.
> This can happen virtually in every possible step of the program as
> long as the python builtins keep doing it.
Well, Python *builtins* (in the strict sense of the word) usually never
directly import anything, and most of them not even indirectly import
(there are some exceptions, of course, like the __import__ builtin)
So if you are certain that the fork doesn't happen *while* an import
is going, then I think the specific problem must be analyzed in more
detail before an attempt is made to fix it.
Regards,
Martin
More information about the Python-Dev
mailing list