atfork

Provides an API to register pre & post callbacks when forking & fixes the standard library to be safe for fork + threads
Download

atfork Ranking & Summary

Advertisement

  • Rating:
  • License:
  • The Apache License 2.0
  • Price:
  • FREE
  • Publisher Name:
  • Gregory P. Smith
  • Publisher web site:

atfork Tags


atfork Description

Provides an API to register pre & post callbacks when forking & fixes the standard library to be safe for fork + threads atfork is a Python library that 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 atforkatfork.monkeypatch_os_fork_functions()import atfork.stdlib_fixeratfork.stdlib_fixer.fix_logging_module() Requirements: · Python


atfork Related Software