Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import threading
- import time
- def worker():
- print threading.currentThread().getName(), 'Starting'
- time.sleep(2)
- print threading.currentThread().getName(), 'Exiting'
- def my_service():
- print threading.currentThread().getName(), 'Starting'
- time.sleep(3)
- print threading.currentThread().getName(), 'Exiting'
- t = threading.Thread(name='my_service', target=my_service)
- w = threading.Thread(name='worker', target=worker)
- w2 = threading.Thread(target=worker) # use default name
- w.start()
- w2.start()
- t.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement