[Python-de] Threading *und* zweimal Forken (Daemon)
Diez Roggisch
deets at web.de
Mi Dez 5 19:00:19 CET 2012
On 12/5/12 6:53 PM, "Christian Heimes" <christian at python.org> wrote:
>Am 05.12.2012 18:41, schrieb Diez Roggisch:
>>> Außerdem
>>> läuft im Child nur noch der Prozess, der fork() aufgerufen hat.
>>
>> Den Satz verstehe ich nicht.
>
>Ja, das wundert mich nicht. ;) Da sollte "Thread" und nicht "Prozess"
>stehen. Irgendwas ist auf dem Weg vom Gehirn zur Hand schief gelaufen.
>
>http://linux.die.net/man/2/fork
>
>The child process is created with a single thread‹the one that called
>fork(). The entire virtual address space of the parent is replicated in
>the child, including the states of mutexes, condition variables, and
> other pthreads objects; the use of pthread_atfork(3) may be helpful
>for dealing with problems that this can cause.
>
>
>Jetzt sollte dir auch klar sein, wie es zu dead locks kommen kann.
Ah, ok. Ich bin an sich eh davon ausgegangen, dass der OP die forks ja eh
nur zur Dämonisierung vornehmen wollte - an sich ist das ein
single-process-Szenario, und die Threads kommen nach dem letzten fork.
Diez
Mehr Informationen über die Mailingliste python-de