class FakeReactor: (source)
Implements interfaces: twisted.internet.interfaces.IReactorThreads
, twisted.internet.interfaces.IReactorTime
A fake reactor implementation which just supports enough reactor APIs for ThreadedResolver
.
Method | __init__ |
Undocumented |
Method | call |
Cause a function to be executed by the reactor thread. |
Method | call |
Run the given callable object in a separate thread, with the given arguments and keyword arguments. |
Method | get |
See twisted.internet.interfaces.IReactorTime.getDelayedCalls |
Method | seconds |
Get the current time in seconds. |
Method | suggest |
Suggest the size of the internal threadpool used to dispatch functions passed to IReactorInThreads.callInThread . |
Instance Variable | call |
Call a function later. |
Instance Variable | get |
Return the threadpool used by IReactorInThreads.callInThread . Create it first if necessary. |
Method | _run |
Undocumented |
Method | _stop |
Undocumented |
Instance Variable | _clock |
Undocumented |
Instance Variable | _thread |
Undocumented |
Instance Variable | _threadpool |
Undocumented |
Cause a function to be executed by the reactor thread.
Use this method when you want to run a function in the reactor's thread from another thread. Calling callFromThread
should wake up the main thread (where reactor.run()
is executing) and run the given callable in that thread.
If you're writing a multi-threaded application the callable may need to be thread safe, but this method doesn't require it as such. If you want to call a function in the next mainloop iteration, but you're in the same thread, use callLater
with a delay of 0.
Parameters | |
callable:Callable[ | Undocumented |
*args | Undocumented |
**kwargs | Undocumented |
Suggest the size of the internal threadpool used to dispatch functions passed to IReactorInThreads.callInThread
.
Call a function later.
Parameters | |
delay | the number of seconds to wait. |
callable | the callable object to call later. |
*args | the arguments to call it with. |
**kwargs | the keyword arguments to call it with. |
Returns | |
An object which provides IDelayedCall and can be used to cancel the scheduled call, by calling its cancel() method. It also may be rescheduled by calling its delay() or reset() methods. |