# Path: lacli/log.py
# def getLogger(logger='lacli'):
#     return lacore.log.getLogger(logger)
# 
# Path: lacli/exceptions.py
# class PauseEvent(BaseAppException):
#     msg = "Paused"


from lacli.log import getLogger
from lacli.exceptions import PauseEvent
from multiprocessing import Queue, active_children
from Queue import Empty

    def pause(self):
        if self.q is not None:
            children = len(active_children())
            getLogger().debug(
                "ControlHandler pausing {} children".format(children))
            map(self.q.put, [{'pause': True}] * children)
        else:
            getLogger().debug(
                "ControlHandler.pause() called " +
                "when no control context in effect")

controlq = None


def controlByQueue(queue):
    global controlq
    controlq = queue


def stopControlByQueue():
    global controlq
    controlq = None


def readControl():
    global controlq
    try:
        msg = controlq.get(False)
        if 'pause' in msg:

# Path: lacli/log.py
# def getLogger(logger='lacli'):
#     return lacore.log.getLogger(logger)
# 
# Path: lacli/exceptions.py
# class PauseEvent(BaseAppException):
#     msg = "Paused"


# Path: lacli/control.py
from lacli.log import getLogger
from lacli.exceptions import PauseEvent
from multiprocessing import Queue, active_children
from Queue import Empty


    def pause(self):
        if self.q is not None:
            children = len(active_children())
            getLogger().debug(
                "ControlHandler pausing {} children".format(children))
            map(self.q.put, [{'pause': True}] * children)
        else:
            getLogger().debug(
                "ControlHandler.pause() called " +
                "when no control context in effect")

controlq = None


def controlByQueue(queue):
    global controlq
    controlq = queue


def stopControlByQueue():
    global controlq
    controlq = None


def readControl():
    global controlq
    try:
        msg = controlq.get(False)
        if 'pause' in msg:

            raise PauseEvent()