def swait(t): """Waits `t' ms""" final_time = T.time()+t/1000. while final_time >= T.time(): T.sleep(0.001) micro.micro_block()
def sendall(self, data): # WARNING: this will busy wait until all data is sent # It should be possible to do away with the busy wait with # the use of a channel. self.sendBuffer += data while self.sendBuffer: micro_block() return len(data)
def ManageSockets(): global managerRunning while len(asyncore.socket_map): # Check the sockets for activity. asyncore.poll(0.05) # Yield to give other tasklets a chance to be scheduled. micro_block() managerRunning = False
def send(self, data): self.sendBuffer += data micro_block() return len(data)