Created
February 4, 2016 08:36
-
-
Save dean/9d11650931d3644e83eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import time | |
class SharedObject(object): | |
def sleep_for_awhile(self, seconds): | |
time.sleep(seconds) | |
print('Slept for %d seconds' % seconds) | |
def output_random_shit(self): | |
print('qwkjelkqwjeklqwlekj') | |
def _thread1(): | |
global so | |
so.sleep_for_awhile(5) | |
return | |
def _thread2(): | |
global so | |
so.output_random_shit() | |
return | |
so = SharedObject() | |
threading.Thread(target=_thread1).start() | |
threading.Thread(target=_thread2).start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment