there's a reason that databases have processes dedicated to writing
That's going to be a little tricky in an embedded db.
Re:“POSIX advisory locks are broken by design”
by emmelaich on Tuesday July 24, 2018 @10:34PM
(#17606543)
Sure, but you could still make sure writes are done in a mutex?
Also, there's a reason that databases have processes dedicated to writing (e.g. Postgres writer process, Oracle dbwr)
Fun fact - IBM's MVS didn't have file locks.