This is a little out there but I've been thinking about it and wondered if 
anyone had any comments:

I've been using sqlite3 under iOS fine in FULLMUTEX mode, but it dies horribly 
with NOMUTEX and I'm pretty sure this is because of my use of Grand Central 
Dispatch (GCD).

GCD is related to threads but has some twists. In my simplified model, I create 
a small number of GCD queues and those are essentially one-to-one to threads. 
Each queue has its own db connection and they aren't shared.

But there's one twist, which is the ability in GCD to make a synchronous call 
from one queue/thread to another. So code executing on queue A in thread A can 
make a synchronous  call to queue B. GCD will make sure that queue B (and queue 
B's thread) is inactive. And my code will make sure that for the duration of 
this call, I'm using queue B's db connection.

But it's "borrowing" queue A's thread. So if sqlite3 does a pthread_self() 
during this call, it's going to get A's threadid, not B's. My guess is this 
confuses it.

So if I wanted to "fix" this, somehow I'd provide a GCD thread provider that 
was essentially posix threads but returns GCDs queue id instead of the 
pthreadid.

Comments? Anybody looked at this?
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to