GNOME Bugzilla – Bug 346338
Threaded database
Last modified: 2007-03-15 13:59:00 UTC
I've split out the threaded database patch from the workerthread patch as I'm planning to drop the workerthread in favor of a better command queueing model.
Created attachment 68235 [details] [review] Threaded database patch v1 Core.cs | 1 Db.cs | 353 +++++++++++++++++++++++++++++++++++++---------- ImportStore.cs | 53 +------ MainWindow.cs | 100 ++++++------- MetaStore.cs | 69 +-------- PhotoStore.cs | 256 ++++++++++------------------------ TagStore.cs | 61 ++------ Updater.cs | 46 +----- 8 files changed, 466 insertions(+), 473 deletions(-)
Created attachment 68257 [details] [review] Threaded database patch v2 .bzrignore | 60 +++++++ src/Core.cs | 1 src/Db.cs | 349 +++++++++++++++++++++++++++++++++---------- src/ImportStore.cs | 53 +----- src/MainWindow.cs | 100 ++++++------ src/MetaStore.cs | 69 +------- src/PhotoStore.cs | 256 +++++++++---------------------- src/TagStore.cs | 61 ++----- src/Updater.cs | 46 +---- 9 files changed, 522 insertions(+), 473 deletions(-) Improved version of the patch, this one uses Queue objects for the queues and eliminates all busy waiting. This way there's no extra CPU usage and no increased latency. It's threading for free! I want to nominate this for CVS, it's finished and rock solid (as far as I can tell, I'm using it for months now).
I really don't think it should be implemented like this. The point is that QueuedSqliteDatabase (which is what a lot of this code is based on) is a layer on top of basic database support that adds QueuedSqliteCommands for async/queued execution inside a single sqlite database thread. I say add the necessary transation support to a shared version of QueuedSqliteDatabase that both F-Spot, Banshee, and other applications can use and then implement your application-specific layer as a wrapper or sub-class. It would be nice to get a lot of this shared functionality into a common assembly.
Sharing this will require gmcs, see bug 346977 for changes to the build system.
The threaded database is in trunk now...