How to use the gbulb.unix_events.DefaultEventLoopPolicy function in gbulb

To help you get started, we’ve selected a few gbulb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github davidedmundson / telepathy-hangups / gbulb / glib_events.py View on Github external
If this flag is set, then this policy will use a glib event loop
            for every thread. Use this parameter if you want your loops to
            interact with modules written in other languages.

        default     Use the default context (default: True)

            Indicates whether you want to use the GLib default context. If set,
            then the loop associated with the main thread will use the default
            (NULL) GLib context (instead of creating a new one).
        """
        self._full    = full
        self._default = default

        self._default_loop = None

        self._policy  = unix_events.DefaultEventLoopPolicy()
        self._policy.new_event_loop = self.new_event_loop

        self.get_event_loop = self._policy.get_event_loop
        self.set_event_loop = self._policy.set_event_loop
        self.get_child_watcher = self._policy.get_child_watcher

        self._policy.set_child_watcher(GLibChildWatcher())

        BaseGLibEventLoop.init_class()

        if threads:
            logger.info("GLib threads enabled")
            GObject.threads_init()
        else:
            logger.info("GLib threads not used")