Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import threading
- import time, os
- def printThread():
- print "Thread Name : " + threading.currentThread().getName() + " Starting"
- time.sleep(3)
- print "Thread Name : " + threading.currentThread().getName() + " Exiting"
- def user_granted():
- print "USER ACCESS FOR SYSTEM " + os.uname()[1] + "Checking ..."
- time.sleep(4)
- print os.uname()[1] + " Access Granted"
- def main():
- thr = []
- whr = []
- for i in range(5):
- t = threading.Thread(name="printThread "+str(i),target=printThread)
- w = threading.Thread(name="ug"+str(i),target=user_granted)
- thr.append(t)
- whr.append(w)
- t.start()
- w.start()
- main()
Add Comment
Please, Sign In to add comment