autobahn.twisted.choosereactor
Module Contents¶
Functions¶
Return class name of currently installed Twisted reactor or None. |
|
|
Try to install the optimal Twisted reactor for this platform: |
|
Install Twisted reactor. |
- autobahn.twisted.choosereactor.current_reactor_klass()[source]¶
Return class name of currently installed Twisted reactor or None.
- autobahn.twisted.choosereactor.install_optimal_reactor(require_optimal_reactor=True)[source]¶
Try to install the optimal Twisted reactor for this platform:
Linux: epoll
BSD/OSX: kqueue
Windows: iocp
Other: select
Notes:
This function exists, because the reactor types selected based on platform in twisted.internet.default are different from here.
The imports are inlined, because the Twisted code base is notorious for importing the reactor as a side-effect of merely importing. Hence we postpone all importing.
See: http://twistedmatrix.com/documents/current/core/howto/choosing-reactor.html#reactor-functionality
- Parameters
require_optimal_reactor (bool) – If
True
and the desired reactor could not be installed, raiseReactorAlreadyInstalledError
, else fallback to another reactor.- Returns
The Twisted reactor in place (twisted.internet.reactor).
- autobahn.twisted.choosereactor.install_reactor(explicit_reactor=None, verbose=False, log=None, require_optimal_reactor=True)[source]¶
Install Twisted reactor.
- Parameters
explicit_reactor (obj) – If provided, install this reactor. Else, install the optimal reactor.
verbose (bool) – If
True
, log (at level “info”) the reactor that is in place afterwards.log (obj) – Explicit logging to this txaio logger object.
require_optimal_reactor (bool) – If
True
and the desired reactor could not be installed, raiseReactorAlreadyInstalledError
, else fallback to another reactor.
- Returns
The Twisted reactor in place (twisted.internet.reactor).