You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reactor.py 1.8KB

5 years ago
123456789101112131415161718192021222324252627282930313233343536373839
  1. # Copyright (c) Twisted Matrix Laboratories.
  2. # See LICENSE for details.
  3. """
  4. The reactor is the Twisted event loop within Twisted, the loop which drives
  5. applications using Twisted. The reactor provides APIs for networking,
  6. threading, dispatching events, and more.
  7. The default reactor depends on the platform and will be installed if this
  8. module is imported without another reactor being explicitly installed
  9. beforehand. Regardless of which reactor is installed, importing this module is
  10. the correct way to get a reference to it.
  11. New application code should prefer to pass and accept the reactor as a
  12. parameter where it is needed, rather than relying on being able to import this
  13. module to get a reference. This simplifies unit testing and may make it easier
  14. to one day support multiple reactors (as a performance enhancement), though
  15. this is not currently possible.
  16. @see: L{IReactorCore<twisted.internet.interfaces.IReactorCore>}
  17. @see: L{IReactorTime<twisted.internet.interfaces.IReactorTime>}
  18. @see: L{IReactorProcess<twisted.internet.interfaces.IReactorProcess>}
  19. @see: L{IReactorTCP<twisted.internet.interfaces.IReactorTCP>}
  20. @see: L{IReactorSSL<twisted.internet.interfaces.IReactorSSL>}
  21. @see: L{IReactorUDP<twisted.internet.interfaces.IReactorUDP>}
  22. @see: L{IReactorMulticast<twisted.internet.interfaces.IReactorMulticast>}
  23. @see: L{IReactorUNIX<twisted.internet.interfaces.IReactorUNIX>}
  24. @see: L{IReactorUNIXDatagram<twisted.internet.interfaces.IReactorUNIXDatagram>}
  25. @see: L{IReactorFDSet<twisted.internet.interfaces.IReactorFDSet>}
  26. @see: L{IReactorThreads<twisted.internet.interfaces.IReactorThreads>}
  27. @see: L{IReactorPluggableResolver<twisted.internet.interfaces.IReactorPluggableResolver>}
  28. """
  29. from __future__ import division, absolute_import
  30. import sys
  31. del sys.modules['twisted.internet.reactor']
  32. from twisted.internet import default
  33. default.install()