예제 #1
0
    def createChannel(self, ipEndpoint=None):
        assert ipEndpoint is None
        viewChannel, managerChannel = SharedStateNative.InMemoryChannel(
            self.callbackScheduler)
        with self.lock:
            self.channelManager.add(managerChannel)
            self.channels.append(managerChannel)

        return viewChannel
예제 #2
0
    def __init__(self, callbackScheduler, filterFun):
        self.filterFun = filterFun
        self.callbackScheduler = callbackScheduler
        self.viewFacingViewChannel, self.filterFacingManagerChannel = SharedStateNative.InMemoryChannel(
            self.callbackScheduler)
        self.filterFacingViewChannel, self.managerFacingManagerChannel = SharedStateNative.InMemoryChannel(
            self.callbackScheduler)
        self.stopFlag = threading.Event()

        self.channelPumpThreads = []
        self.channelPumpThreads.append(
            ManagedThread.ManagedThread(target=self.filteredChannelPump,
                                        args=(self.filterFacingManagerChannel,
                                              self.filterFacingViewChannel)))
        self.channelPumpThreads.append(
            ManagedThread.ManagedThread(
                target=self.filteredChannelPump,
                args=(self.filterFacingViewChannel,
                      self.filterFacingManagerChannel)))
        for thread in self.channelPumpThreads:
            thread.start()
 def test_channel_wrappers(self):
     viewChannel, managerChannel = SharedStateNative.InMemoryChannel(
         callbackScheduler)
     message = SharedState.MessageOut.MinimumIdResponse(0)
     viewChannel.write(message)
     managerChannel.get()