| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Icecast
Revision: 15120
Author: karl
Date: 18 Jul 2008 21:30:16
Changes: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.
| ... | ...@@ -54,7 +54,9 @@ | |
| 54 | 54 | node->rank_and_balance = 0; |
| 55 | 55 | AVL_SET_BALANCE (node, 0); |
| 56 | 56 | AVL_SET_RANK (node, 1); |
| 57 | #ifdef HAVE_AVL_NODE_LOCK | |
| 57 | 58 | thread_rwlock_create(&node->rwlock); |
| 59 | #endif | |
| 58 | 60 | return node; |
| 59 | 61 | } |
| 60 | 62 | } |
| ... | ...@@ -95,7 +97,9 @@ | |
| 95 | 97 | if (node->right) { |
| 96 | 98 | avl_tree_free_helper (node->right, free_key_fun); |
| 97 | 99 | } |
| 100 | #ifdef HAVE_AVL_NODE_LOCK | |
| 98 | 101 | thread_rwlock_destroy (&node->rwlock); |
| 102 | #endif | |
| 99 | 103 | free (node); |
| 100 | 104 | } |
| 101 | 105 | |
| ... | ...@@ -106,7 +110,9 @@ | |
| 106 | 110 | avl_tree_free_helper (tree->root->right, free_key_fun); |
| 107 | 111 | } |
| 108 | 112 | if (tree->root) { |
| 113 | #ifdef HAVE_AVL_NODE_LOCK | |
| 109 | 114 | thread_rwlock_destroy(&tree->root->rwlock); |
| 115 | #endif | |
| 110 | 116 | free (tree->root); |
| 111 | 117 | } |
| 112 | 118 | thread_rwlock_destroy(&tree->rwlock); |
| ... | ...@@ -450,7 +456,9 @@ | |
| 450 | 456 | /* return the key and node to storage */ |
| 451 | 457 | if (free_key_fun) |
| 452 | 458 | free_key_fun (x->key); |
| 459 | #ifdef HAVE_AVL_NODE_LOCK | |
| 453 | 460 | thread_rwlock_destroy (&x->rwlock); |
| 461 | #endif | |
| 454 | 462 | free (x); |
| 455 | 463 | |
| 456 | 464 | while (shorter && p->parent) { |
| ... | ...@@ -1168,6 +1176,7 @@ | |
| 1168 | 1176 | thread_rwlock_unlock(&tree->rwlock); |
| 1169 | 1177 | } |
| 1170 | 1178 | |
| 1179 | #ifdef HAVE_AVL_NODE_LOCK | |
| 1171 | 1180 | void avl_node_rlock(avl_node *node) |
| 1172 | 1181 | { |
| 1173 | 1182 | thread_rwlock_rlock(&node->rwlock); |
| ... | ...@@ -1182,3 +1191,4 @@ | |
| 1182 | 1191 | { |
| 1183 | 1192 | thread_rwlock_unlock(&node->rwlock); |
| 1184 | 1193 | } |
| 1194 | #endif |
| ... | ...@@ -32,7 +32,7 @@ | |
| 32 | 32 | * The rest of the bits are used for <rank> |
| 33 | 33 | */ |
| 34 | 34 | unsigned int rank_and_balance; |
| 35 | #ifndef NO_THREAD | |
| 35 | #if !defined(NO_THREAD) && defined(HAVE_AVL_NODE_LOCK) | |
| 36 | 36 | rwlock_t rwlock; |
| 37 | 37 | #endif |
| 38 | 38 | } avl_node; |