From 6a0fdb312f560e3f6b946bf7de0eabdbcb9b4cb2 Mon Sep 17 00:00:00 2001
From: "Kevin P. Fleming" <kpfleming@digium.com>
Date: Thu, 23 Jun 2005 17:30:56 +0000
Subject: [PATCH] don't take locks when reading usecounts, they are not
 necessary (bug #4585)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5983 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 formats/format_g723.c     | 9 +--------
 formats/format_g726.c     | 9 +--------
 formats/format_g729.c     | 9 +--------
 formats/format_gsm.c      | 9 +--------
 formats/format_h263.c     | 9 +--------
 formats/format_ilbc.c     | 9 +--------
 formats/format_pcm.c      | 9 +--------
 formats/format_pcm_alaw.c | 9 +--------
 formats/format_sln.c      | 9 +--------
 formats/format_vox.c      | 9 +--------
 formats/format_wav.c      | 9 +--------
 formats/format_wav_gsm.c  | 9 +--------
 12 files changed, 12 insertions(+), 96 deletions(-)

diff --git a/formats/format_g723.c b/formats/format_g723.c
index d0e1b23258..91187c3bd7 100755
--- a/formats/format_g723.c
+++ b/formats/format_g723.c
@@ -249,14 +249,7 @@ int unload_module()
 
 int usecount()
 {
-	int res;
-	if (ast_mutex_lock(&g723_lock)) {
-		ast_log(LOG_WARNING, "Unable to lock g723 list\n");
-		return -1;
-	}
-	res = glistcnt;
-	ast_mutex_unlock(&g723_lock);
-	return res;
+	return glistcnt;
 }
 
 char *description()
diff --git a/formats/format_g726.c b/formats/format_g726.c
index 4813a72c08..a71c1226a8 100755
--- a/formats/format_g726.c
+++ b/formats/format_g726.c
@@ -482,14 +482,7 @@ int unload_module()
 
 int usecount()
 {
-	int res;
-	if (ast_mutex_lock(&g726_lock)) {
-		ast_log(LOG_WARNING, "Unable to lock g726 list.\n");
-		return -1;
-	}
-	res = glistcnt;
-	ast_mutex_unlock(&g726_lock);
-	return res;
+	return glistcnt;
 }
 
 char *description()
diff --git a/formats/format_g729.c b/formats/format_g729.c
index 19e6809be9..d28098f89b 100755
--- a/formats/format_g729.c
+++ b/formats/format_g729.c
@@ -229,14 +229,7 @@ int unload_module()
 
 int usecount()
 {
-	int res;
-	if (ast_mutex_lock(&g729_lock)) {
-		ast_log(LOG_WARNING, "Unable to lock g729 list\n");
-		return -1;
-	}
-	res = glistcnt;
-	ast_mutex_unlock(&g729_lock);
-	return res;
+	return glistcnt;
 }
 
 char *description()
diff --git a/formats/format_gsm.c b/formats/format_gsm.c
index 01fb2a1f94..43a2bb6bfc 100755
--- a/formats/format_gsm.c
+++ b/formats/format_gsm.c
@@ -252,14 +252,7 @@ int unload_module()
 
 int usecount()
 {
-	int res;
-	if (ast_mutex_lock(&gsm_lock)) {
-		ast_log(LOG_WARNING, "Unable to lock gsm list\n");
-		return -1;
-	}
-	res = glistcnt;
-	ast_mutex_unlock(&gsm_lock);
-	return res;
+	return glistcnt;
 }
 
 char *description()
diff --git a/formats/format_h263.c b/formats/format_h263.c
index 990acbecc4..b98ed19e33 100755
--- a/formats/format_h263.c
+++ b/formats/format_h263.c
@@ -250,14 +250,7 @@ int unload_module()
 
 int usecount()
 {
-	int res;
-	if (ast_mutex_lock(&h263_lock)) {
-		ast_log(LOG_WARNING, "Unable to lock h263 list\n");
-		return -1;
-	}
-	res = glistcnt;
-	ast_mutex_unlock(&h263_lock);
-	return res;
+	return glistcnt;
 }
 
 char *description()
diff --git a/formats/format_ilbc.c b/formats/format_ilbc.c
index a690f26901..1d4388a7c4 100755
--- a/formats/format_ilbc.c
+++ b/formats/format_ilbc.c
@@ -231,14 +231,7 @@ int unload_module()
 
 int usecount()
 {
-	int res;
-	if (ast_mutex_lock(&ilbc_lock)) {
-		ast_log(LOG_WARNING, "Unable to lock ilbc list\n");
-		return -1;
-	}
-	res = glistcnt;
-	ast_mutex_unlock(&ilbc_lock);
-	return res;
+	return glistcnt;
 }
 
 char *description()
diff --git a/formats/format_pcm.c b/formats/format_pcm.c
index 5c28fe3d12..cf166350c7 100755
--- a/formats/format_pcm.c
+++ b/formats/format_pcm.c
@@ -219,14 +219,7 @@ int unload_module()
 
 int usecount()
 {
-	int res;
-	if (ast_mutex_lock(&pcm_lock)) {
-		ast_log(LOG_WARNING, "Unable to lock pcm list\n");
-		return -1;
-	}
-	res = glistcnt;
-	ast_mutex_unlock(&pcm_lock);
-	return res;
+	return glistcnt;
 }
 
 char *description()
diff --git a/formats/format_pcm_alaw.c b/formats/format_pcm_alaw.c
index b5de9f980c..827c1420b8 100755
--- a/formats/format_pcm_alaw.c
+++ b/formats/format_pcm_alaw.c
@@ -299,14 +299,7 @@ int unload_module()
 
 int usecount()
 {
-	int res;
-	if (ast_mutex_lock(&pcm_lock)) {
-		ast_log(LOG_WARNING, "Unable to lock pcm list\n");
-		return -1;
-	}
-	res = glistcnt;
-	ast_mutex_unlock(&pcm_lock);
-	return res;
+	return glistcnt;
 }
 
 char *description()
diff --git a/formats/format_sln.c b/formats/format_sln.c
index b7b309cea8..ab4d347578 100755
--- a/formats/format_sln.c
+++ b/formats/format_sln.c
@@ -218,14 +218,7 @@ int unload_module()
 
 int usecount()
 {
-	int res;
-	if (ast_mutex_lock(&slinear_lock)) {
-		ast_log(LOG_WARNING, "Unable to lock slinear list\n");
-		return -1;
-	}
-	res = glistcnt;
-	ast_mutex_unlock(&slinear_lock);
-	return res;
+	return glistcnt;
 }
 
 char *description()
diff --git a/formats/format_vox.c b/formats/format_vox.c
index e8f9218eae..a3aa6ce142 100755
--- a/formats/format_vox.c
+++ b/formats/format_vox.c
@@ -222,14 +222,7 @@ int unload_module()
 
 int usecount()
 {
-	int res;
-	if (ast_mutex_lock(&vox_lock)) {
-		ast_log(LOG_WARNING, "Unable to lock vox list\n");
-		return -1;
-	}
-	res = glistcnt;
-	ast_mutex_unlock(&vox_lock);
-	return res;
+	return glistcnt;
 }
 
 char *description()
diff --git a/formats/format_wav.c b/formats/format_wav.c
index 6e9246754c..182e40c601 100755
--- a/formats/format_wav.c
+++ b/formats/format_wav.c
@@ -574,14 +574,7 @@ int unload_module()
 
 int usecount()
 {
-	int res;
-	if (ast_mutex_lock(&wav_lock)) {
-		ast_log(LOG_WARNING, "Unable to lock wav list\n");
-		return -1;
-	}
-	res = glistcnt;
-	ast_mutex_unlock(&wav_lock);
-	return res;
+	return glistcnt;
 }
 
 char *description()
diff --git a/formats/format_wav_gsm.c b/formats/format_wav_gsm.c
index 866c5f54cc..fd6d7874de 100755
--- a/formats/format_wav_gsm.c
+++ b/formats/format_wav_gsm.c
@@ -555,14 +555,7 @@ int unload_module()
 
 int usecount()
 {
-	int res;
-	if (ast_mutex_lock(&wav_lock)) {
-		ast_log(LOG_WARNING, "Unable to lock wav list\n");
-		return -1;
-	}
-	res = glistcnt;
-	ast_mutex_unlock(&wav_lock);
-	return res;
+	return glistcnt;
 }
 
 char *description()
-- 
GitLab