Skip to content

Instantly share code, notes, and snippets.

@dean
Created February 4, 2016 08:36
Show Gist options
  • Save dean/9d11650931d3644e83eb to your computer and use it in GitHub Desktop.
Save dean/9d11650931d3644e83eb to your computer and use it in GitHub Desktop.
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