I am writing an application that it has to be able to control many concurrent records, either through threads of processes according . So no mutes or lock should be applied to it.
To use the locks at least to go down, I'm ready to be the file "app-only", so all the data is first added to the disk, and then at that address The given address has been updated, which has been changed to refer to the new one. So I have to implement a small lock system so that it can change an int, so it refers to the new address. What is the best way to do this?
I was probably thinking about putting a flag before finding out, when it is set, the spin locks will be used for readers until it is released. But I'm afraid that it is not atomic at all, is not it? For example
- A reader reads the flag, and it is not unset
- At the same time, a writer writes flags and changes the value of int
- The reader can read an incompatible value!
I'm looking for technology locking, but I think that for thread locking techniques or not to lock the whole file, not the field. Is not it possible to do this? How does ADID-only database handle this?
EDIT: I was seeing how only APPDD's (CHDBs) do it, and it seems that they use a thread in order to write the file. Does this mean that it is not possible to do the embedded, SQLite without locking the entire file with the file system lock?
Thank you! Be careful about the sequence semantics of your file system - it probably does not provide atom attachment functions.
Comments
Post a Comment