I'm facing problem in gsoap , if two user go to register
at a same time then database is
locked, i think its threading problem , how to handle it, please insist me. I am running multiple threads in background. every 5 seconds sending data to server.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
Generally speaking, when working with a database it should be set up so you don't have to worry about things like that. As EIYusubov suggested, you need to look into the code you are using for for DB access. What types of reads and writes are you requesting?
(Most) DBs are intended to be multi-user and multi-threaded / multi-session. Sending data every five seconds (as suggested by Tech.Rahul) is or should be nothing to a DB server, and you shouldn't have any lock contention.
It's possible you could have a case where one user is getting stale data.
User A @ 4.9 seconds - retrieves dataset XYZ^1 User B @ 5.0 seconds - updates dataset XYZ^1 to become => XYZ^2 User C @ 5.1 seconds - retrieves dataset XYZ^2
Note: times in the example are just arbitrary
So User C wouldn't have what User A is looking at, but that' not going to cause a deadlock situation as you described. Given the short amount of time elapsed between User A and User C, then User A could be said to be looking at dirty data.