evolution-data-server r8881 - branches/camel-db-summary/camel



Author: psankar
Date: Sun Jun  1 13:14:24 2008
New Revision: 8881
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8881&view=rev

Log:
Remove read_lock .

Sqlite handles write-starvation and ensures ACID. We dont have to lock
our READ calls.



Modified:
   branches/camel-db-summary/camel/camel-db.c
   branches/camel-db-summary/camel/camel-db.h

Modified: branches/camel-db-summary/camel/camel-db.c
==============================================================================
--- branches/camel-db-summary/camel/camel-db.c	(original)
+++ branches/camel-db-summary/camel/camel-db.c	Sun Jun  1 13:14:24 2008
@@ -54,7 +54,6 @@
 	cdb = g_new (CamelDB, 1);
 	cdb->db = db;
 	cdb->lock = g_mutex_new ();
-	cdb->read_lock = g_mutex_new ();
 	d(g_print ("\nDatabase succesfully opened  \n"));
 	return cdb;
 }
@@ -65,7 +64,6 @@
 	if (cdb) {
 		sqlite3_close (cdb->db);
 		g_mutex_free (cdb->lock);
-		g_mutex_free (cdb->read_lock);
 		g_free (cdb);
 		d(g_print ("\nDatabase succesfully closed \n"));
 	}
@@ -193,13 +191,11 @@
 
 	if (!cdb)
 		return 0;
-	g_mutex_lock (cdb->read_lock);
 	ret = sqlite3_exec(cdb->db, stmt, count_cb, &count, &errmsg);
   	if(ret != SQLITE_OK) {
     		d(g_warning ("Error in select statement %s [%s].\n", stmt, errmsg));
 		sqlite3_free (errmsg);
   	}
-	g_mutex_unlock (cdb->read_lock);
 	d(g_print("count of '%s' is %d\n", stmt, count));
 	return count;
 }
@@ -214,7 +210,6 @@
 
 	if (!cdb)
 		return TRUE;
-	g_mutex_lock (cdb->read_lock);	
   	ret = sqlite3_exec(cdb->db, stmt, callback, data, &errmsg);
 
   	if(ret != SQLITE_OK) {
@@ -222,7 +217,6 @@
 		camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, errmsg);
 		sqlite3_free (errmsg);
   	}
-	g_mutex_unlock (cdb->read_lock);
 
 	return ret;
 }

Modified: branches/camel-db-summary/camel/camel-db.h
==============================================================================
--- branches/camel-db-summary/camel/camel-db.h	(original)
+++ branches/camel-db-summary/camel/camel-db.h	Sun Jun  1 13:14:24 2008
@@ -11,7 +11,6 @@
 struct _CamelDB {
 	sqlite3 *db;
 	GMutex *lock;
-	GMutex *read_lock;
 };
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]