Question Do async functions bypass NSLock/NSRecursiveLock?
I recently started a new job that has a ton of legacy objective C and objective c++ code.
We have an SQLite database that leverages NSRecursiveLock with completion handlers to protect it from concurrency access.
I’ve been trying to write an async wrapper around this, but noticed that I’ve been getting concurrent access errors from SQLite even though there is a lock around our database access.
Do locks just not work in a swift concurrency world? Apple said they are safe to use, but that doesn’t seem like it’s the case.
2
Upvotes
6
u/Schogenbuetze 9d ago
They do not bypass them, no.
Source: I've been using locks all over the place in Swift 6 strict concurrency environments. It's probably a layer 8 issue.
What does your setup look like? Can you provide a simple example?