[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Monotone-devel] RFC: do no exit mtn if database is locked
From: |
Thomas Keller |
Subject: |
Re: [Monotone-devel] RFC: do no exit mtn if database is locked |
Date: |
Fri, 27 Oct 2006 20:58:52 +0200 |
User-agent: |
Thunderbird 1.5.0.7 (Macintosh/20060909) |
Nuno Lucas schrieb:
The functionality you are implementing is already provided by
sqlite3_busy_timeout(), and handles the case of waiting a fixed time
(you could get a client "starved" for long periods of time with this
aproach), as long as sqlite3OsSleep() is implemented with the
equivalent of usleep() (which posix and windows OS's do).
I read of that one as well, but I thought of this as being a bit
unflexible, also because one cannot inform the user that we're actually
waiting for such a lock (which is the main thing IMHO), as he/she would
just sit in front of mtn and think "why does this action take so long?!"
Also, by always retrying, you can get into a deadlock, as explained in
the documentation you have linked to.
One could solve this by only trying to gather the lock a specific amount
of tries or allow to ctrl-c before this happens.
You may want to give a look into the sqliteDefaultBusyCallback()
implementation (in the sqlite source file main.c), which is the one
setup by the sqlite3_busy_timeout() function.
Indeed, I could snatch the code right from there =)
Thomas.
--
- "I know that I don't know." (Sokrates)
Guitone, a frontend for monotone: http://guitone.berlios.de
Music lyrics and more: http://musicmademe.com