Class FdHandler
object --+
|
FdHandler
Adds a callback for activity on the given file descriptor.
func will be called during the execution of
main_loop_begin() when the file descriptor is available for
reading, or writing, or both.
When the handler func is called, it must return a value of
either True or False (remember that Python returns None if no value is
explicitly returned and None evaluates to False). If it returns
True, it will continue to montior the given file descriptor, or if
it returns False it will be deleted automatically making any
references/handles for it invalid.
FdHandler use includes:
-
handle multiple socket connections using a single process;
-
thread wake-up and synchronization;
-
non-blocking file description operations.
func signature: func(fd_handler, *args, **kargs):
bool
|
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
|
|
a new object with type S, a subtype of T
|
|
|
|
|
|
bool
|
active_get(...)
Return if read, write or error, or a combination thereof, is active
on the file descriptor of the given FD handler. |
|
|
|
active_set(...)
Set what active streams the given FdHandler should be monitoring. |
|
|
bool
|
|
bool
|
|
|
delete(...)
Stop callback emission and free internal resources. |
|
|
int
|
|
bool
|
|
|
|
|
|
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__ ,
__sizeof__ ,
__subclasshook__
|
|
fd
|
Inherited from object :
__class__
|
__init__(...)
(Constructor)
|
|
x.__init__(...) initializes x; see x.__class__.__doc__ for
signature
- Overrides:
object.__init__
|
- Returns: a new object with type S, a subtype of T
- Overrides:
object.__new__
|
__repr__(...)
(Representation operator)
|
|
repr(x)
- Overrides:
object.__repr__
- (inherited documentation)
|
__str__(...)
(Informal representation operator)
|
|
str(x)
- Overrides:
object.__str__
- (inherited documentation)
|
prepare_callback_set(...)
|
|
Set a function to call becore doing the select() on the fd.
Signature: function(object, *args, **kargs)
|