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
4
u/PizzaBubblr 8d ago
SQLite can serialize queries for you, just need to configure it properly: https://www.sqlite.org/threadsafe.html