Make sure that any terminal processes still running when __del__ was called
    to the waited and cleaned up.
179029
def _cleanup():
    '''
    
    '''
    for inst in _ACTIVE[:]:
        res = inst.isalive()
        if res is not True:
            try:
                _ACTIVE.remove(inst)
            except ValueError:
                # This can happen if two threads create a new Terminal instance
                # It's harmless that it was already removed, so ignore.
                pass
28797
async def clean(self):
        
        for x in self._running_asyncio_tasks:
            x.cancel()
        self._container_had_error = set()
        self._watching = set()
        self._running_asyncio_tasks = set()
1110436
def flush(flush = Zlib::SYNC_FLUSH)
      run '', flush unless flush == Zlib::NO_FLUSH

      detatch_output
    end
650685
async def _cleanup(self):
        
        while True:
            await asyncio.sleep(CLEANUP_INTERVAL_S)
            self._tasks = {t for t in self._tasks if not t.done()}
92993
def flush(self):
        
        if hasattr(self, 'flush_commands'):
            context = self
        else:
            context = get_current_canvas().context
        context.glir.command('FUNC', 'glFlush')
        context.flush_commands()
255773
def _cleanup(self) -> None:
        """"""
        if self._cleanup_handle:
            self._cleanup_handle.cancel()

        now = self._loop.time()
        timeout = self._keepalive_timeout

        if self._conns:
            connections = {}
            deadline = now - timeout
            for key, conns in self._conns.items():
                alive = []
                for proto, use_time in conns:
                    if proto.is_connected():
                        if use_time - deadline < 0:
                            transport = proto.transport
                            proto.close()
                            if (key.is_ssl and
                                    not self._cleanup_closed_disabled):
                                self._cleanup_closed_transports.append(
                                    transport)
                        else:
                            alive.append((proto, use_time))

                if alive:
                    connections[key] = alive

            self._conns = connections

        if self._conns:
            self._cleanup_handle = helpers.weakref_handle(
                self, '_cleanup', timeout, self._loop)
805656
def cleanup(self):
        
        if getattr(self._finalizer, "detach", None) and self._finalizer.detach():
            if os.path.exists(self.path):
                try:
                    rmtree(self.path)
                except OSError:
                    pass
                else:
                    self.path = None
1250342
def cleanup(self):
        """"""
        if self.allow_disable_global:
            # Return paging state
            output_mode_cmd = "set output {}".format(self._output_mode)
            enable_paging_commands = ["config system console", output_mode_cmd, "end"]
            if self.vdoms:
                enable_paging_commands.insert(0, "config global")
            # Should test output is valid
            for command in enable_paging_commands:
                self.send_command_timing(command)
981674
def _check_pid(self, allow_reset=False):
        """"""
        if not self.pid == current_process().pid:
            if allow_reset:
                self.reset()
            else:
                raise RuntimeError("Forbidden operation in multiple processes")
1191901
def clean(self):
        
        if self.cleaners:
            yield from asyncio.wait([x() for x in self.cleaners],
                                    loop=self.loop)
607089
def run(self):
        '''
        
        '''
        salt.utils.process.appendproctitle(self.__class__.__name__)

        # init things that need to be done after the process is forked
        self._post_fork_init()

        # Make Start Times
        last = int(time.time())

        old_present = set()
        while True:
            now = int(time.time())
            if (now - last) >= self.loop_interval:
                salt.daemons.masterapi.clean_old_jobs(self.opts)
                salt.daemons.masterapi.clean_expired_tokens(self.opts)
                salt.daemons.masterapi.clean_pub_auth(self.opts)
                salt.daemons.masterapi.clean_proc_dir(self.opts)
            self.handle_git_pillar()
            self.handle_schedule()
            self.handle_key_cache()
            self.handle_presence(old_present)
            self.handle_key_rotate(now)
            salt.utils.verify.check_max_open_files(self.opts)
            last = now
            time.sleep(self.loop_interval)
1043344
def killall(self):
        
        for pid in set(self):
            try:
                os.kill(pid, signal.SIGTERM)
            except OSError, e: # pragma: nocover
                if e.errno == errno.ESRCH:
                    "Process previously died on its own"
            self.remove(pid)
639415
def _orphan_this_process(cls, wait_for_parent=False):
        """"""
        # The current PID will be the PPID of the forked child
        ppid = os.getpid()

        pid = os.fork()
        if pid > 0:
            # Exit parent
            sys.exit(0)

        if wait_for_parent and cls._pid_is_alive(ppid, timeout=1):
            raise DaemonError(
                'Parent did not exit while trying to orphan process')
1129757
def _exec_cleanup(self, cursor, fd):
        
        LOGGER.debug('Closing cursor and cleaning %s', fd)
        try:
            cursor.close()
        except (psycopg2.Error, psycopg2.Warning) as error:
            LOGGER.debug('Error closing the cursor: %s', error)

        self._cleanup_fd(fd)

        # If the cleanup callback exists, remove it
        if self._cleanup_callback:
            self._ioloop.remove_timeout(self._cleanup_callback)

        # Create a new cleanup callback to clean the pool of idle connections
        self._cleanup_callback = self._ioloop.add_timeout(
            self._ioloop.time() + self._pool_idle_ttl + 1,
            self._pool_manager.clean, self.pid)
1352453
def _clean_servers(self):
        
        if len(self._telnet_servers) > 0:
            for telnet_server in self._telnet_servers:
                telnet_server.close()
                yield from telnet_server.wait_closed()
            self._telnet_servers = []
1117782
def _cleanup(self):
        '''
        
        '''
        self._ack_listener = None
        self._nack_listener = None
        self._broker_cancel_cb_map = None
        super(RabbitBasicClass, self)._cleanup()
318793
def clear_unattached_processes(self):
        
        for pid in self.get_process_ids():
            aProcess = self.get_process(pid)
            if not aProcess.is_being_debugged():
                self._del_process(aProcess)