What about doing this via NFS? I presume no guarantee? ________________________________________ From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Dan Kennedy [danielk1...@gmail.com] Sent: Thursday, September 26, 2013 11:31 AM To: sqlite-users@sqlite.org Subject: Re: [sqlite] Using an sqlite db as a mutex?
On 09/26/2013 10:00 PM, Simon Slavin wrote: > On 26 Sep 2013, at 3:45pm, Dan Kennedy <danielk1...@gmail.com> wrote: > >> Sounds right. BEGIN EXCLUSIVE obtains an exclusive lock on >> the db. If this succeeds, no other connection to the same database >> will be able to successfully execute BEGIN EXCLUSIVE until >> your first connection has concluded its transaction or closed >> the database handle. > EXCLUSIVE implies IMMEDIATE, right ? Just thought it was worth checking. It does. Both open a write transaction on the database. In the\ parent posts case either would work. In WAL mode they are the same thing. But in rollback mode EXCLUSIVE grabs an exclusive lock. Locking out readers as well as other writers. IMMEDIATE just grabs the reserved lock - locking out other writers but allowing other clients to read. $ ./sqlite3 abc.db SQLite version 3.8.1 2013-09-26 15:21:16 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> BEGIN EXCLUSIVE; sqlite> PRAGMA lock_status; main|exclusive temp|closed sqlite> COMMIT; sqlite> BEGIN IMMEDIATE; sqlite> PRAGMA lock_status; main|reserved temp|closed _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users