diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-18 16:37:14 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-18 16:37:14 +0000 |
commit | fb6dd0231c961987239ba47085320b9e70445fd5 (patch) | |
tree | eb5b643560baa6c7f9d5fe8043c675fa97e06e43 /main/dnsmgr.c | |
parent | 36a2e6ea7e7f77dcdb5dce866f5e2ee60181b631 (diff) |
Few more rwlist conversions... why not.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@69705 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/dnsmgr.c')
-rw-r--r-- | main/dnsmgr.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/main/dnsmgr.c b/main/dnsmgr.c index 803151add..44a43991a 100644 --- a/main/dnsmgr.c +++ b/main/dnsmgr.c @@ -60,12 +60,12 @@ struct ast_dnsmgr_entry { /*! Set to 1 if the entry changes */ int changed:1; ast_mutex_t lock; - AST_LIST_ENTRY(ast_dnsmgr_entry) list; + AST_RWLIST_ENTRY(ast_dnsmgr_entry) list; /*! just 1 here, but we use calloc to allocate the correct size */ char name[1]; }; -static AST_LIST_HEAD_STATIC(entry_list, ast_dnsmgr_entry); +static AST_RWLIST_HEAD_STATIC(entry_list, ast_dnsmgr_entry); AST_MUTEX_DEFINE_STATIC(refresh_lock); @@ -97,9 +97,9 @@ struct ast_dnsmgr_entry *ast_dnsmgr_get(const char *name, struct in_addr *result ast_mutex_init(&entry->lock); strcpy(entry->name, name); - AST_LIST_LOCK(&entry_list); - AST_LIST_INSERT_HEAD(&entry_list, entry, list); - AST_LIST_UNLOCK(&entry_list); + AST_RWLIST_WRLOCK(&entry_list); + AST_RWLIST_INSERT_HEAD(&entry_list, entry, list); + AST_RWLIST_UNLOCK(&entry_list); return entry; } @@ -109,9 +109,9 @@ void ast_dnsmgr_release(struct ast_dnsmgr_entry *entry) if (!entry) return; - AST_LIST_LOCK(&entry_list); - AST_LIST_REMOVE(&entry_list, entry, list); - AST_LIST_UNLOCK(&entry_list); + AST_RWLIST_WRLOCK(&entry_list); + AST_RWLIST_REMOVE(&entry_list, entry, list); + AST_RWLIST_UNLOCK(&entry_list); if (option_verbose > 3) ast_verbose(VERBOSE_PREFIX_4 "removing dns manager for '%s'\n", entry->name); @@ -302,10 +302,10 @@ static int handle_cli_status(int fd, int argc, char *argv[]) ast_cli(fd, "DNS Manager: %s\n", enabled ? "enabled" : "disabled"); ast_cli(fd, "Refresh Interval: %d seconds\n", refresh_interval); - AST_LIST_LOCK(&entry_list); - AST_LIST_TRAVERSE(&entry_list, entry, list) + AST_RWLIST_RDLOCK(&entry_list); + AST_RWLIST_TRAVERSE(&entry_list, entry, list) count++; - AST_LIST_UNLOCK(&entry_list); + AST_RWLIST_UNLOCK(&entry_list); ast_cli(fd, "Number of entries: %d\n", count); return 0; |