[asterisk-commits] dlee: branch dlee/hashtab-skiplist r399765 - in /team/dlee/hashtab-skiplist: ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Sep 24 18:22:46 CDT 2013
Author: dlee
Date: Tue Sep 24 18:22:44 2013
New Revision: 399765
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399765
Log:
Bookkeeping
Modified:
team/dlee/hashtab-skiplist/channels/chan_console.c
team/dlee/hashtab-skiplist/main/astobj2.c
Modified: team/dlee/hashtab-skiplist/channels/chan_console.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/hashtab-skiplist/channels/chan_console.c?view=diff&rev=399765&r1=399764&r2=399765
==============================================================================
--- team/dlee/hashtab-skiplist/channels/chan_console.c (original)
+++ team/dlee/hashtab-skiplist/channels/chan_console.c Tue Sep 24 18:22:44 2013
@@ -76,6 +76,7 @@
#include "asterisk/musiconhold.h"
#include "asterisk/callerid.h"
#include "asterisk/astobj2.h"
+#include "asterisk/stasis_channels.h"
/*!
* \brief The sample rate to request from PortAudio
Modified: team/dlee/hashtab-skiplist/main/astobj2.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/hashtab-skiplist/main/astobj2.c?view=diff&rev=399765&r1=399764&r2=399765
==============================================================================
--- team/dlee/hashtab-skiplist/main/astobj2.c (original)
+++ team/dlee/hashtab-skiplist/main/astobj2.c Tue Sep 24 18:22:44 2013
@@ -1946,6 +1946,8 @@
struct hash_bucket {
/*! List of objects held in the bucket. */
AST_DLLIST_HEAD_NOLOCK(, hash_bucket_node) list;
+ /*! Next node links for the bucket skip list */
+ AST_DLLIST_ENTRY(hash_bucket) skip_links;
#if defined(AST_DEVMODE)
/*! Number of elements currently in the bucket. */
int elements;
@@ -1966,6 +1968,8 @@
*/
struct ao2_container common;
ao2_hash_fn *hash_fn;
+ /*! Buckets with contents */
+ AST_DLLIST_HEAD_NOLOCK(, hash_bucket) skip_list;
/*! Number of hash buckets in this container. */
int n_buckets;
/*! Hash bucket array of n_buckets. Variable size. */
@@ -2086,6 +2090,11 @@
bucket = &my_container->buckets[doomed->my_bucket];
AST_DLLIST_REMOVE(&bucket->list, doomed, links);
AO2_DEVMODE_STAT(--my_container->common.nodes);
+
+ /* If we become empty, remove from the skip list */
+ if (AST_DLLIST_EMPTY(&bucket->list)) {
+ AST_DLLIST_REMOVE(&my_container->skip_list, bucket, skip_links);
+ }
}
/*
@@ -2159,6 +2168,11 @@
bucket = &self->buckets[node->my_bucket];
sort_fn = self->common.sort_fn;
options = self->common.options;
+
+ /* If we become not empty, add ourselves to the skip list */
+ if (AST_DLLIST_EMPTY(&bucket->list)) {
+ AST_DLLIST_INSERT_TAIL(&self->skip_list, bucket, skip_links);
+ }
if (options & AO2_CONTAINER_ALLOC_OPT_INSERT_BEGIN) {
if (sort_fn) {
More information about the asterisk-commits
mailing list