|
Project Information
Featured
Downloads
|
This project provides a pthread_atfork() work-a-like API for Python 2.4, 2.5 and 2.6 along with fixers to monkey patch standard library modules at run time to be safe in programs using both threading and forking. While mixing threads and forking in a program is generally considered to be a bad idea it need not be so painful. A missing API in the Python is an atfork mechanism so that locks can be acquired and released properly around fork calls. This module adds that. It also provides monkeypatchers that fix the standard library to properly register callbacks for locks they create. Tested On: Python 2.4.3, 2.4.5, 2.4.6, 2.5.2, & 2.6.2. Documentation: Read the atfork and stdlib_fixer module docstrings. In short, put the following very early in your main program's imports: import atfork atfork.monkeypatch_os_fork_functions() import atfork.stdlib_fixer atfork.stdlib_fixer.fix_logging_module() |