Skip to content

Commit

Permalink
try locking as CS
Browse files Browse the repository at this point in the history
  • Loading branch information
juliannguyen4 committed Oct 24, 2024
1 parent 9d7fe51 commit ff830d5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/new_tests/test_free_threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ def test_unsafe(self):
THREAD_COUNT = 10
barrier = threading.Barrier(parties=THREAD_COUNT)
config = {"hosts": [("127.0.0.1", 3000)]}
lock = threading.Lock()

def read_bin():
nonlocal barrier, config
nonlocal barrier, config, lock
barrier.wait()
client = aerospike.client(config)
_, _, bins = client.get(key)
nonlocal bin_value_sum
lock.acquire()
bin_value_sum += bins["a"]
lock.release()

workers = []
for _ in range(THREAD_COUNT):
Expand Down

0 comments on commit ff830d5

Please sign in to comment.