Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 1 | :mod:`dummy_threading` --- Drop-in replacement for the :mod:`threading` module |
| 2 | ============================================================================== |
| 3 | |
| 4 | .. module:: dummy_threading |
| 5 | :synopsis: Drop-in replacement for the threading module. |
| 6 | |
Raymond Hettinger | 469271d | 2011-01-27 20:38:46 +0000 | [diff] [blame^] | 7 | **Source code:** :source:`Lib/dummy_threading.py` |
| 8 | |
| 9 | -------------- |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 10 | |
| 11 | This module provides a duplicate interface to the :mod:`threading` module. It |
Georg Brandl | 2067bfd | 2008-05-25 13:05:15 +0000 | [diff] [blame] | 12 | is meant to be imported when the :mod:`_thread` module is not provided on a |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 13 | platform. |
| 14 | |
| 15 | Suggested usage is:: |
| 16 | |
| 17 | try: |
Georg Brandl | 2067bfd | 2008-05-25 13:05:15 +0000 | [diff] [blame] | 18 | import threading |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 19 | except ImportError: |
Georg Brandl | 2067bfd | 2008-05-25 13:05:15 +0000 | [diff] [blame] | 20 | import dummy_threading |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 21 | |
Georg Brandl | 2067bfd | 2008-05-25 13:05:15 +0000 | [diff] [blame] | 22 | Be careful to not use this module where deadlock might occur from a thread being |
| 23 | created that blocks waiting for another thread to be created. This often occurs |
| 24 | with blocking I/O. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 25 | |