Thanks Dan, The problem is that connection A is calling a function which is attempting to open a new SHARED connection. Since it can't (B's PENDING prevents this, because of A's earlier SHARED connection), A blocks.
If instead, A does not open a new connection, but uses what it already has open, it all works like a charm. I'm beginning to think this is expected behaviour. > > Continually returns SQLITE_BUSY, right? Doesn't actually block? > > Was the INSERT attempted by B inside a transaction? I'm guessing > so. > > This isn't really a threading problem. Once connection B has the > PENDING lock, no new connections will be able to get the SHARED > lock required to read the database. The connection held by thread > A already has it's shared lock, so it can continue to read. Once > B commits or rolls it's transaction back, the PENDING lock will > be dropped and other connections, including new connections, will > be able to obtain new SHARED locks. > > If I've understood things right... > > Dan.