lock.py 747 B

123456789101112131415161718192021222324252627282930
  1. import sys
  2. if sys.version_info < (3,):
  3. try:
  4. from thread import allocate_lock
  5. except ImportError:
  6. from dummy_thread import allocate_lock
  7. else:
  8. try:
  9. from _thread import allocate_lock
  10. except ImportError:
  11. from _dummy_thread import allocate_lock
  12. ##import sys
  13. ##l1 = allocate_lock
  14. ##class allocate_lock(object):
  15. ## def __init__(self):
  16. ## self._real = l1()
  17. ## def __enter__(self):
  18. ## for i in range(4, 0, -1):
  19. ## print sys._getframe(i).f_code
  20. ## print
  21. ## return self._real.__enter__()
  22. ## def __exit__(self, *args):
  23. ## return self._real.__exit__(*args)
  24. ## def acquire(self, f):
  25. ## assert f is False
  26. ## return self._real.acquire(f)