tracker r2153 - in branches/indexer-split: . src/libtracker-db



Author: pvanhoof
Date: Tue Aug 26 12:21:54 2008
New Revision: 2153
URL: http://svn.gnome.org/viewvc/tracker?rev=2153&view=rev

Log:
2008-08-26  Philip Van Hoof  <philip codeminded be>

        * src/libtracker-db/tracker-db-index.c: removed a mutex. The API of
        tracker-db-index.h is never used by more than one thread. Therefore
        can't there be a need for a mutex. If we do need a mutex, then just
        reverting this wont suffice: changes that will happen after this
        commit will require using a recursive mutex instead.



Modified:
   branches/indexer-split/ChangeLog
   branches/indexer-split/src/libtracker-db/tracker-db-index.c

Modified: branches/indexer-split/src/libtracker-db/tracker-db-index.c
==============================================================================
--- branches/indexer-split/src/libtracker-db/tracker-db-index.c	(original)
+++ branches/indexer-split/src/libtracker-db/tracker-db-index.c	Tue Aug 26 12:21:54 2008
@@ -45,7 +45,6 @@
 struct TrackerDBIndexPrivate {
 	/* From the daemon */
 	DEPOT      *index;
-	GMutex     *mutex;
 
 	guint       min_bucket;
         guint       max_bucket;
@@ -147,7 +146,6 @@
 
 	priv = TRACKER_DB_INDEX_GET_PRIVATE (index);
 
-	priv->mutex = g_mutex_new ();
 	priv->reload = TRUE;
 
 	priv->cache = g_hash_table_new_full (g_str_hash,
@@ -172,7 +170,6 @@
 
 	g_free (priv->filename);
 
-	g_mutex_free (priv->mutex);
 
 	G_OBJECT_CLASS (tracker_db_index_parent_class)->finalize (object);
 }
@@ -385,9 +382,7 @@
 
         priv = TRACKER_DB_INDEX_GET_PRIVATE (index);
 
-	g_mutex_lock (priv->mutex);
         count = dpgetwb (priv->index, word, -1, 0, 32, buffer);
-	g_mutex_unlock (priv->mutex);
 
 	return count > 7;
 }
@@ -401,9 +396,7 @@
 
         priv = TRACKER_DB_INDEX_GET_PRIVATE (index);
 
-	g_mutex_lock (priv->mutex);
 	tsiz = dpvsiz (priv->index, word, -1);
-	g_mutex_unlock (priv->mutex);
 
 	return tsiz;
 }
@@ -743,7 +736,6 @@
 	g_return_val_if_fail (priv->filename != NULL, FALSE);
 	g_return_val_if_fail (priv->index == NULL, FALSE);
 
-	g_mutex_lock (priv->mutex);
 
 	g_debug ("Opening index:'%s' (%s)", 
 		 priv->filename,
@@ -796,7 +788,6 @@
 		priv->reload = TRUE;
 	}
 	
-	g_mutex_unlock (priv->mutex);
 
 	return !priv->reload;
 }
@@ -811,7 +802,6 @@
 
 	priv = TRACKER_DB_INDEX_GET_PRIVATE (index);
 
-	g_mutex_lock (priv->mutex);
 
 	retval = TRUE;
 
@@ -827,7 +817,6 @@
 		priv->index = NULL;
 	}
 
-	g_mutex_unlock (priv->mutex);
 
 	return retval;
 }
@@ -842,11 +831,9 @@
 
 	priv = TRACKER_DB_INDEX_GET_PRIVATE (index);
 
-        g_mutex_lock (priv->mutex);
 
 	if (!priv->index) {
 		g_debug ("Index was not open for flush, waiting...");
-		g_mutex_unlock (priv->mutex);
 
 		return 0;
 	}
@@ -861,7 +848,6 @@
 					     priv->index);
 	}
 
-	g_mutex_unlock (priv->mutex);
 
 	return size;
 }
@@ -880,9 +866,7 @@
 
         priv = TRACKER_DB_INDEX_GET_PRIVATE (index);
 
-        g_mutex_lock (priv->mutex);
         size = dpfsiz (priv->index);
-        g_mutex_unlock (priv->mutex);
 
 	return size;
 }
@@ -913,13 +897,11 @@
 	winner_str = g_strdup (term);
         winner_dist = G_MAXINT;  /* Initialize to the worst case */
 
-	g_mutex_lock (priv->mutex);
         dpiterinit (priv->index);
 
 	g_get_current_time (&start);
 
 	str = dpiternext (priv->index, NULL);
-	g_mutex_unlock (priv->mutex);
 
 	while (str != NULL) {
 		dist = levenshtein (term, str, 0);
@@ -954,9 +936,7 @@
                         break;
 		}
 
-                g_mutex_lock (priv->mutex);
 		str = dpiternext (priv->index, NULL);
-                g_mutex_unlock (priv->mutex);
 	}
 
         return winner_str;
@@ -981,7 +961,6 @@
 		return NULL;
 	}
 
-	g_mutex_lock (priv->mutex);
 
 	details = NULL;
 
@@ -999,7 +978,6 @@
 		}
 	}
 
-	g_mutex_unlock (priv->mutex);
 
 	return details;
 }
@@ -1022,7 +1000,6 @@
 
 	priv = TRACKER_DB_INDEX_GET_PRIVATE (index);
 
-        g_mutex_lock (priv->mutex);
 
 	elem.id = service_id;
 	elem.amalgamated = tracker_db_index_item_calc_amalgamated (service_type, weight);
@@ -1036,7 +1013,6 @@
 		array = g_array_new (FALSE, TRUE, sizeof (TrackerDBIndexItem));
 		g_hash_table_insert (priv->cache, g_strdup (word), array);
 		g_array_append_val (array, elem);
-		g_mutex_unlock (priv->mutex);
 
 		return;
 	} 
@@ -1065,7 +1041,6 @@
 										new_score);
 			}
 
-			g_mutex_unlock (priv->mutex);
 
 			return;
 		}
@@ -1074,7 +1049,6 @@
 	/* First time in the file */
 	g_array_append_val (array, elem);
 
-        g_mutex_unlock (priv->mutex);
 }
 
 /*
@@ -1105,7 +1079,6 @@
 
 	g_return_val_if_fail (priv->index, FALSE);
 
-	g_mutex_lock (priv->mutex);
 
 	/* Check if existing record is there  */
 	tmp = dpget (priv->index,
@@ -1116,7 +1089,6 @@
                      &tsiz);
 
         if (!tmp) {
-		g_mutex_unlock (priv->mutex);
                 return FALSE;
         }
 
@@ -1167,7 +1139,6 @@
 
         g_free (tmp);
 
-	g_mutex_unlock (priv->mutex);
 
 	return retval;
 }



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