def putTo(self, queueLabel, func, args, kwargs): if queueLabel in self.childQueues: self.childQueues[queueLabel].put((func, args, kwargs)) else: self.childQueues[queueLabel] = Queue.Queue() self.childQueues[queueLabel].put((func, args, kwargs)) StartDaemonThread(workAt, self.childQueues[queueLabel])
def setup(self): socketserver.StreamRequestHandler.setup(self) self.nick = None self.realname = None self.password = None self.me = None self.isSupported = IrcSet() self.joinedChannels = IrcSet() self.useNamedChannel = False self.channelNames = UniqNameMap(self, True) self.nickNames = UniqNameMap(self, False) self.onProtocolDecided = self.onProtocolDecided_ self.onQQMessage = self.onQQMessage_pending self.qqMessageQueue = [] self.lineProcessor_ = self.processLine_unregistered self.senderQueue = Queue.Queue() self.fetch_cv = threading.Condition() self.fetch_result = None self.server.addClient(self) reader = threading.Thread(target=self.reader) reader.daemon = True reader.start()
def addWorkerTo(self, queueLabel, n): if queueLabel not in self.childQueues: self.childQueues[queueLabel] = Queue.Queue() for i in range(n): StartDaemonThread(workAt, self.childQueues[queueLabel])
def __init__(self): self.mainQueue = Queue.Queue() self.childQueues = {}