C
Chris
I am developping a smart device app that uses data stored in mobile SQL server.
There is a background thread that every specified period of time
synchronizes data from desktop SQL server to mobile one (by webservice). The
thread inserts data to mobile sql server only.
The data stored in the mobile database can be olsa synchronized by user
(simply by clicking a button in app). How to handle situation when data in
the database is being synchronized by the user (by clicking the button) and
the background thread?
I have tried to use 1 mutex (Mutex.WaitOne() and Mutex.ReleaseMutex()). But
in my opininion it does not work properly. Even if the mutex has been locked
(WaitOne() method return true value), callinng WaitOne() returns true again.
Why?
It seems that synchronization by user and the thread at the same time causes
errors/crashes in the app. Maybe should I use Monitor instead of Mutex (or
lock keyword)?
Should I use Monitor/Mutex (or lock) when I am calling select/delete in the
database?
There is a background thread that every specified period of time
synchronizes data from desktop SQL server to mobile one (by webservice). The
thread inserts data to mobile sql server only.
The data stored in the mobile database can be olsa synchronized by user
(simply by clicking a button in app). How to handle situation when data in
the database is being synchronized by the user (by clicking the button) and
the background thread?
I have tried to use 1 mutex (Mutex.WaitOne() and Mutex.ReleaseMutex()). But
in my opininion it does not work properly. Even if the mutex has been locked
(WaitOne() method return true value), callinng WaitOne() returns true again.
Why?
It seems that synchronization by user and the thread at the same time causes
errors/crashes in the app. Maybe should I use Monitor instead of Mutex (or
lock keyword)?
Should I use Monitor/Mutex (or lock) when I am calling select/delete in the
database?