コード例 #1
0
ファイル: manager.py プロジェクト: AlphaStaxLLC/TundraAddons
    def start(self, sleep=0, log=True, link=None, process=False):
        group = None
        target = self.run
        name = self.__class__.__name__
        mode = "P" if process else "T"
        args = (sleep, log, mode)

        if process and HAS_MULTIPROCESSING:
            if link is not None and isinstance(link, Manager):
                from circuits.net.sockets import Pipe
                from circuits.core.bridge import Bridge
                from circuits.core.utils import findroot

                root = findroot(link)
                parent, child = Pipe()
                self._bridge = Bridge(root, socket=parent)
                self._bridge.start()
                args += (child,)

            self._task = Process(group, target, name, args)
            self._task.daemon = True
            if HAS_MULTIPROCESSING == 2:
                setattr(self._task, "isAlive", self._task.is_alive)
            self.tick()
            self._task.start()
            return

        self._task = Thread(group, target, name, args)
        self._task.setDaemon(True)
        self._task.start()
コード例 #2
0
 def register(self, parent):
     super(UPnPDeviceServer, self).register(parent)
     # SSDP transceiver, may exist only once
     if not any([isinstance(c, SSDPTranceiver) \
                 for c in flatten(findroot(self))]):
         SSDPTranceiver().register(self.parent)
     return self
コード例 #3
0
ファイル: device_server.py プロジェクト: mnlipp/CoCy
 def register(self, parent):
     super(UPnPDeviceServer, self).register(parent)
     # SSDP transceiver, may exist only once
     if not any([isinstance(c, SSDPTranceiver) \
                 for c in flatten(findroot(self))]):
         SSDPTranceiver().register(self.parent)
     return self
コード例 #4
0
ファイル: manager.py プロジェクト: marijamarkovic/naali
    def start(self, sleep=0, log=True, link=None, process=False):
        group = None
        target = self.run
        name = self.__class__.__name__
        mode = "P" if process else "T"
        args = (
            sleep,
            log,
            mode,
        )

        if process and HAS_MULTIPROCESSING:
            if link is not None and isinstance(link, Manager):
                from circuits.net.sockets import Pipe
                from circuits.core.bridge import Bridge
                from circuits.core.utils import findroot
                root = findroot(link)
                parent, child = Pipe()
                self._bridge = Bridge(root, socket=parent)
                self._bridge.start()
                args += (child, )

            self._task = Process(group, target, name, args)
            self._task.daemon = True
            if HAS_MULTIPROCESSING == 2:
                setattr(self._task, "isAlive", self._task.is_alive)
            self.tick()
            self._task.start()
            return

        self._task = Thread(group, target, name, args)
        self._task.setDaemon(True)
        self._task.start()
コード例 #5
0
ファイル: test_utils.py プロジェクト: billtsay/win-demo-opcua
def test_findroot():
    app = App()
    a = A()
    b = B()

    b.register(a)
    a.register(app)

    while app:
        app.flush()

    root = findroot(b)

    assert root == app
コード例 #6
0
ファイル: test_utils.py プロジェクト: treemo/circuits
def test_findroot():
    app = App()
    a = A()
    b = B()

    b.register(a)
    a.register(app)

    while app:
        app.flush()

    root = findroot(b)

    assert root == app