Skip to content

Instantly share code, notes, and snippets.

@justinwoo
Created January 18, 2013 03:53
Show Gist options
  • Save justinwoo/4562216 to your computer and use it in GitHub Desktop.
Save justinwoo/4562216 to your computer and use it in GitHub Desktop.
just a template for myself
from multiprocessing import Process, Lock
def f(lock, name, number):
for x in range(1,100):
lock.acquire()
print '%s: %i' % (name, x)
lock.release()
if __name__ == '__main__':
lock = Lock()
for num in range(1,10):
Process(target = f, args = (lock, 'thread', num)).start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment