[xiph-commits] r15120 - icecast/trunk/avl

karl at svn.xiph.org karl at svn.xiph.org
Fri Jul 18 18:30:18 PDT 2008


Author: karl
Date: 2008-07-18 18:30:16 -0700 (Fri, 18 Jul 2008)
New Revision: 15120

Modified:
   icecast/trunk/avl/avl.c
   icecast/trunk/avl/avl.h
Log:
Don't include a per node lock unless it is really wanted. I don't think anyone
is using them currently, so lets reduce the structure size.  On win32, this
extra lock increases the handles usage considerably.


Modified: icecast/trunk/avl/avl.c
===================================================================
--- icecast/trunk/avl/avl.c	2008-07-18 02:32:54 UTC (rev 15119)
+++ icecast/trunk/avl/avl.c	2008-07-19 01:30:16 UTC (rev 15120)
@@ -54,7 +54,9 @@
     node->rank_and_balance = 0;
     AVL_SET_BALANCE (node, 0);
     AVL_SET_RANK (node, 1);
+#ifdef HAVE_AVL_NODE_LOCK
     thread_rwlock_create(&node->rwlock);
+#endif
     return node;
   }
 }         
@@ -95,7 +97,9 @@
   if (node->right) {
     avl_tree_free_helper (node->right, free_key_fun);
   }
+#ifdef HAVE_AVL_NODE_LOCK
   thread_rwlock_destroy (&node->rwlock);
+#endif
   free (node);
 }
   
@@ -106,7 +110,9 @@
     avl_tree_free_helper (tree->root->right, free_key_fun);
   }
   if (tree->root) {
+#ifdef HAVE_AVL_NODE_LOCK
     thread_rwlock_destroy(&tree->root->rwlock);
+#endif
     free (tree->root);
   }
   thread_rwlock_destroy(&tree->rwlock);
@@ -450,7 +456,9 @@
   /* return the key and node to storage */
   if (free_key_fun)
       free_key_fun (x->key);
+#ifdef HAVE_AVL_NODE_LOCK
   thread_rwlock_destroy (&x->rwlock);
+#endif
   free (x);
 
   while (shorter && p->parent) {
@@ -1168,6 +1176,7 @@
     thread_rwlock_unlock(&tree->rwlock);
 }
 
+#ifdef HAVE_AVL_NODE_LOCK
 void avl_node_rlock(avl_node *node)
 {
     thread_rwlock_rlock(&node->rwlock);
@@ -1182,3 +1191,4 @@
 {
     thread_rwlock_unlock(&node->rwlock);
 }
+#endif

Modified: icecast/trunk/avl/avl.h
===================================================================
--- icecast/trunk/avl/avl.h	2008-07-18 02:32:54 UTC (rev 15119)
+++ icecast/trunk/avl/avl.h	2008-07-19 01:30:16 UTC (rev 15120)
@@ -32,7 +32,7 @@
    * The rest of the bits are used for <rank>
    */
   unsigned int        rank_and_balance;
-#ifndef NO_THREAD
+#if !defined(NO_THREAD) && defined(HAVE_AVL_NODE_LOCK)
   rwlock_t rwlock;
 #endif
 } avl_node;



More information about the commits mailing list