aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_oss.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-23 22:46:31 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-23 22:46:31 +0000
commitc7776916251e958e39a2fefd6a28a92fda4db23a (patch)
tree13789be06a91f943c067cfb42b6a1219d6328d6f /channels/chan_oss.c
parent2fca1655a1f427219d3a65e2c403a76bde344352 (diff)
Update channel drivers to use module referencing so that unloading them while in use will not result in crashes. (issue #8897 reported by junky)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@51788 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_oss.c')
-rw-r--r--channels/chan_oss.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index 06a287957..3e23e8172 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -281,10 +281,6 @@ END_CONFIG
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
-
-static int usecnt;
-AST_MUTEX_DEFINE_STATIC(usecnt_lock);
-
static char *config = "oss.conf"; /* default config file */
static int oss_debug;
@@ -842,9 +838,7 @@ static int oss_hangup(struct ast_channel *c)
c->tech_pvt = NULL;
o->owner = NULL;
ast_verbose(" << Hangup on console >> \n");
- ast_mutex_lock(&usecnt_lock); /* XXX not sure why */
- usecnt--;
- ast_mutex_unlock(&usecnt_lock);
+ ast_module_unref(ast_module_info->self);
if (o->hookstate) {
if (o->autoanswer || o->autohangup) {
/* Assume auto-hangup too */
@@ -1025,10 +1019,7 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o, char *ext, char *ctx,
c->cid.cid_dnid = ast_strdup(ext);
o->owner = c;
- ast_mutex_lock(&usecnt_lock);
- usecnt++;
- ast_mutex_unlock(&usecnt_lock);
- ast_update_use_count();
+ ast_module_ref(ast_module_info->self);
ast_jb_configure(c, &global_jbconf);
if (state != AST_STATE_DOWN) {
if (ast_pbx_start(c)) {