import threaddef counter(myId, count): for i in range(count): mutex.acquire() print '[%s] => %s' % (myId, i) mutex.release()mutex = thread.allocate_lock()for i in range(10): thread.start_new(counter, (i, 100))import timetime.sleep(10) print 'Main thread exiting.'
Name (required)
email (will not be published) (required)
Website