Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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")
def __new__(cls, *k, **kw):
raise RuntimeError("GLib threads not enabled (you should use %s(threads=True)" % self.__class__.__name__)
threading.Thread.__new__ = __new__