efl.ecore.FdHandler Class

class efl.ecore.FdHandler(fd, int flags, func, *args, **kargs)

Bases: object

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 monitor 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.
Parameters:
  • fd – file descriptor or object with fileno() method.
  • flags – bitwise OR of ECORE_FD_READ, ECORE_FD_WRITE…
  • func – function to call when file descriptor state changes.

Expected func signature:

func(fd_handler, *args, **kargs): bool
active_get

Return if read, write or error, or a combination thereof, is active on the file descriptor of the given FD handler.

Return type:bool
active_set

Set what active streams the given FdHandler should be monitoring.

Parameters:flags – one of - ECORE_FD_NONE - ECORE_FD_READ - ECORE_FD_WRITE - ECORE_FD_ERROR - ECORE_FD_ALL
can_read
Return type:bool
can_write
Return type:bool
delete

Stop callback emission and free internal resources.

fd_get

Get the file descriptor number

Return type:int
has_error
Return type:bool
is_deleted

Check if the object has been deleted thus leaving the object shallow.

Returns:True if the object has been deleted yet, False otherwise.
Return type:bool

New in version 1.18.

prepare_callback_set

Set a function to call before doing the select() on the fd.

Expected signature:

function(object, *args, **kargs)
stop

Alias for delete.