Exemplo n.º 1
0
        class FuncHolder(object):
            count = threadutil.AtomicCounter()

            def function(self, values):
                result = [value + 1 for value in values]
                self.count.incr()
                return result
Exemplo n.º 2
0
        class ConnectingThread(threadutil.Thread):
            new_connections = threadutil.AtomicCounter()

            def __init__(self, proxy, event):
                threadutil.Thread.__init__(self)
                self.proxy = proxy
                self.event = event
                self.setDaemon(True)
                self.new_connections.reset()

            def run(self):
                self.event.wait()
                if self.proxy._pyroBind():
                    ConnectingThread.new_connections.incr()  # 1 more new connection done
Exemplo n.º 3
0
        class FuncHolder(object):
            count = threadutil.AtomicCounter()

            def function(self, value, increase=1):
                self.count.incr()
                return value + increase