MCPcopy Create free account
hub / github.com/catboost/catboost / test_concurrent_lock

Function test_concurrent_lock

library/python/filelock/ut/test_filelock.py:60–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

58
59
60def test_concurrent_lock():
61 filename = 'thread.lock'
62
63 def lock():
64 lock = library.python.filelock.FileLock(filename)
65 time.sleep(1)
66 assert lock.acquire()
67 lock.release()
68 try:
69 os.unlink(filename)
70 except OSError:
71 pass
72
73 threads = []
74 for i in range(100):
75 t = threading.Thread(target=lock)
76 threads.append(t)
77
78 for t in threads:
79 t.start()
80
81 for t in threads:
82 t.join()
83
84
85def test_pidfilelock():

Callers

nothing calls this directly

Calls 4

rangeFunction · 0.50
appendMethod · 0.45
startMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected