import adihe,string,socket,time,os,sys,threading
num=0
class Thread():
lock=threading.Lock()
def lock(self):
self.lock.acquire()
def unlock(self):
self.lock.release()
def p2(a):
global num
thread.lock()
num+=1
print(a+num)
time.sleep(3)
thread.unlock()
def p1(a):
for i in range(3):
info='this %s thread'%(i)
p2(info)
def main():
for i in range(3):
p1(i)
if __name__ == '__main__':
thread=Thread()
main()