> We must distinguish between locks owned by the thread which survived the
> fork(), and locks owned by other threads. I guess it's possible if we
> keep track of the thread id which acquired the lock, and if we give
> _whatever_after_fork() the thread id of the thread which initiated the
> fork() in the parent process. Do you think it would be enough to
> guarantee correctness?

Interestingly, the POSIX pthread_atfork documentation defines how you
are supposed to do that: create an atfork handler set, and acquire all
mutexes in the prepare handler. Then fork, and have the parent and child
handlers release the locks. Of course, unless your locks are recursive,
you still have to know what locks you are already holding.

Regards,
Martin


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to