From 7aadac132d8512e7ee63970561f40ade80772726 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 29 Mar 2011 16:31:59 +0200 Subject: Support for shared cache and unlock notification --- odb/sqlite/connection.hxx | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'odb/sqlite/connection.hxx') diff --git a/odb/sqlite/connection.hxx b/odb/sqlite/connection.hxx index 5390609..3ae82e3 100644 --- a/odb/sqlite/connection.hxx +++ b/odb/sqlite/connection.hxx @@ -13,6 +13,8 @@ #include // std::auto_ptr #include +#include +#include #include #include @@ -35,7 +37,7 @@ namespace odb virtual ~connection (); - connection (database_type&); + connection (database_type&, int extra_flags = 0); database_type& database () @@ -56,6 +58,12 @@ namespace odb return *statement_cache_; } + // Wait for the locks to be released via unlock notification. Can + // be called after getting SQLITE_LOCKED_SHAREDCACHE. + // + void + wait (); + public: // Reset active and finalize uncached statements. // @@ -67,14 +75,24 @@ namespace odb connection& operator= (const connection&); private: - friend class statement; - database_type& db_; sqlite3* handle_; + // Unlock notification machinery. + // + private: + bool unlocked_; + details::mutex unlock_mutex_; + details::condition unlock_cond_; + + friend void + connection_unlock_callback (void**, int); + // Linked list of active and uncached statements currently associated // with this connection. // + private: + friend class statement; statement* statements_; std::auto_ptr statement_cache_; -- cgit v1.1