import os, sys, time from threading import Thread from threading import currentThread import SimpleXMLRPCServer servAddr = ("localhost", 8000) serv = SimpleXMLRPCServer.SimpleXMLRPCServer(servAddr) tt = [] import SimpleXMLRPCServer class myThread(Thread): def __init__ (self,p): self.p = p Thread.__init__(self) def run (self): t = currentThread() while 1: n = random.random() tt[self.p] = self.p + '!!!' time.sleep(n) def rn(): mythreads = [] for p in (1,2,3): t = myThread(p) mythreads.append(t) t.start() return 1 def test(): return tt serv.register_function(rn) serv.register_function(test) serv.register_introspection_functions()
2
votes
2 Answers
2
votes