efl.ecore.FdHandler Class

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

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