MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / __enter__

Method __enter__

test/browser_common.py:651–664  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

649 self.counter = 0
650
651 def __enter__(self):
652 # Acquire the lock
653 while True:
654 try:
655 self.fd = os.open(self.path, os.O_CREAT | os.O_EXCL | os.O_WRONLY)
656 break
657 except FileExistsError:
658 time.sleep(0.1)
659 # Return the locking count number
660 try:
661 self.counter = int(utils.read_file(f'{self.path}_counter'))
662 except Exception:
663 pass
664 return self.counter
665
666 def __exit__(self, *a):
667 # Increment locking count number before releasing the lock

Callers

nothing calls this directly

Calls 2

sleepMethod · 0.80
openMethod · 0.45

Tested by

no test coverage detected