Ejemplo n.º 1
0
    def start_periodic_monitoring_thread(self):
        if self.periodic_monitoring_thread is None and GEVENT_CONFIG.monitor_thread:
            # Note that it is possible for one real thread to
            # (temporarily) wind up with multiple monitoring threads,
            # if hubs are started and stopped within the thread. This shows up
            # in the threadpool tests. The monitoring threads will eventually notice their
            # hub object is gone.
            from gevent._monitor import PeriodicMonitoringThread
            from gevent.events import PeriodicMonitorThreadStartedEvent
            from gevent.events import notify_and_call_entry_points
            self.periodic_monitoring_thread = PeriodicMonitoringThread(self)

            if self.main_hub:
                self.periodic_monitoring_thread.install_monitor_memory_usage()

            notify_and_call_entry_points(PeriodicMonitorThreadStartedEvent(
                self.periodic_monitoring_thread))

        return self.periodic_monitoring_thread
Ejemplo n.º 2
0
Archivo: hub.py Proyecto: gevent/gevent
    def start_periodic_monitoring_thread(self):
        if self.periodic_monitoring_thread is None and GEVENT_CONFIG.monitor_thread:
            # Note that it is possible for one real thread to
            # (temporarily) wind up with multiple monitoring threads,
            # if hubs are started and stopped within the thread. This shows up
            # in the threadpool tests. The monitoring threads will eventually notice their
            # hub object is gone.
            from gevent._monitor import PeriodicMonitoringThread
            from gevent.events import PeriodicMonitorThreadStartedEvent
            from gevent.events import notify_and_call_entry_points
            self.periodic_monitoring_thread = PeriodicMonitoringThread(self)

            if self.main_hub:
                self.periodic_monitoring_thread.install_monitor_memory_usage()

            notify_and_call_entry_points(PeriodicMonitorThreadStartedEvent(
                self.periodic_monitoring_thread))

        return self.periodic_monitoring_thread
Ejemplo n.º 3
0
def _notify_patch(event, _warnings=None):
    # Raises DoNotPatch if we're not supposed to patch
    from gevent.events import notify_and_call_entry_points

    event._warnings = _warnings
    notify_and_call_entry_points(event)
Ejemplo n.º 4
0
def _notify_patch(event, _warnings=None):
    # Raises DoNotPatch if we're not supposed to patch
    from gevent.events import notify_and_call_entry_points

    event._warnings = _warnings
    notify_and_call_entry_points(event)