Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
write a thread safe code and check your Sqlite features - – Yusubov Jul 14 '12 at 9:53
up vote 1 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.