# Path: cherrypy/_cpcompat.py
#     def ntob(n, encoding='ISO-8859-1'):
#     def ntou(n, encoding='ISO-8859-1'):
#     def tonative(n, encoding='ISO-8859-1'):
#     def ntob(n, encoding='ISO-8859-1'):
#     def ntou(n, encoding='ISO-8859-1'):
#     def tonative(n, encoding='ISO-8859-1'):
# def assert_native(n):
# def base64_decode(n, encoding='ISO-8859-1'):
#     def sorted(i):
#     def reversed(x):
#     def get_daemon(t):
#     def set_daemon(t, val):
#     def get_daemon(t):
#     def set_daemon(t, val):
#     def HTTPDate(timeval=None):
#     def unquote_qs(atom, encoding, errors='strict'):
#     def unquote_qs(atom, encoding, errors='strict'):
#         def json_decode(s):
#         def _json_encode(s):
#         def json_encode(value):
#     def random20():
#     def random20():
#     def next(i):
#     def __get_daemon(self):
#     def __set_daemon(self, daemon):
# class SetDaemonProperty:


import os
import re
import signal as _signal
import sys
import time
import threading
    import pwd, grp
from cherrypy._cpcompat import basestring, get_daemon, get_thread_ident, ntob, set, Timer, SetDaemonProperty
                        self.bus.log("Restarting because %s changed." % filename)
                        self.thread.cancel()
                        self.bus.log("Stopped thread %r." % self.thread.getName())
                        self.bus.restart()
                        return


class ThreadManager(SimplePlugin):
    """Manager for HTTP request threads.

    If you have control over thread creation and destruction, publish to
    the 'acquire_thread' and 'release_thread' channels (for each thread).
    This will register/unregister the current thread and publish to
    'start_thread' and 'stop_thread' listeners in the bus as needed.

    If threads are created and destroyed by code you do not control
    (e.g., Apache), then, at the beginning of every HTTP request,
    publish to 'acquire_thread' only. You should not publish to
    'release_thread' in this case, since you do not know whether
    the thread will be re-used or not. The bus will call
    'stop_thread' listeners for you when it stops.
    """

    threads = None
    """A map of {thread ident: index number} pairs."""

    def __init__(self, bus):
        self.threads = {}
        SimplePlugin.__init__(self, bus)
        self.bus.listeners.setdefault('acquire_thread', set())

# Path: cherrypy/_cpcompat.py
#     def ntob(n, encoding='ISO-8859-1'):
#     def ntou(n, encoding='ISO-8859-1'):
#     def tonative(n, encoding='ISO-8859-1'):
#     def ntob(n, encoding='ISO-8859-1'):
#     def ntou(n, encoding='ISO-8859-1'):
#     def tonative(n, encoding='ISO-8859-1'):
# def assert_native(n):
# def base64_decode(n, encoding='ISO-8859-1'):
#     def sorted(i):
#     def reversed(x):
#     def get_daemon(t):
#     def set_daemon(t, val):
#     def get_daemon(t):
#     def set_daemon(t, val):
#     def HTTPDate(timeval=None):
#     def unquote_qs(atom, encoding, errors='strict'):
#     def unquote_qs(atom, encoding, errors='strict'):
#         def json_decode(s):
#         def _json_encode(s):
#         def json_encode(value):
#     def random20():
#     def random20():
#     def next(i):
#     def __get_daemon(self):
#     def __set_daemon(self, daemon):
# class SetDaemonProperty:


# Path: cherrypy/process/plugins.py
import os
import re
import signal as _signal
import sys
import time
import threading
    import pwd, grp
from cherrypy._cpcompat import basestring, get_daemon, get_thread_ident, ntob, set, Timer, SetDaemonProperty

                        self.bus.log("Restarting because %s changed." % filename)
                        self.thread.cancel()
                        self.bus.log("Stopped thread %r." % self.thread.getName())
                        self.bus.restart()
                        return


class ThreadManager(SimplePlugin):
    """Manager for HTTP request threads.

    If you have control over thread creation and destruction, publish to
    the 'acquire_thread' and 'release_thread' channels (for each thread).
    This will register/unregister the current thread and publish to
    'start_thread' and 'stop_thread' listeners in the bus as needed.

    If threads are created and destroyed by code you do not control
    (e.g., Apache), then, at the beginning of every HTTP request,
    publish to 'acquire_thread' only. You should not publish to
    'release_thread' in this case, since you do not know whether
    the thread will be re-used or not. The bus will call
    'stop_thread' listeners for you when it stops.
    """

    threads = None
    """A map of {thread ident: index number} pairs."""

    def __init__(self, bus):
        self.threads = {}
        SimplePlugin.__init__(self, bus)
        self.bus.listeners.setdefault('acquire_thread', set())

        self.bus.listeners.setdefault('start_thread', set())