Created
January 18, 2013 03:53
-
-
Save justinwoo/4562216 to your computer and use it in GitHub Desktop.
just a template for myself
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
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