I am working on an Android application which has most of the code in C. I have compiled SQLite in C and using it.
I have following code:
void func_foo(){
Select X from table1
Update X in table1
}
I want that func_foo
behaves atomically and this function is getting called from multiple threads.
My concern is that once I ran select statement from thread1, thread2 should not modify the data of the tables in between.
So will wrapping the whole DB operation inside a transaction make it atomic?
Or do I need to use mutex over the function so that only one instance can access the DB?