[zaptel-commits] mattf: branch 1.4 r1606 - /branches/1.4/zaptel.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Thu Nov 16 16:13:15 MST 2006


Author: mattf
Date: Thu Nov 16 17:13:14 2006
New Revision: 1606

URL: http://svn.digium.com/view/zaptel?view=rev&rev=1606
Log:
Fix for 7769

Modified:
    branches/1.4/zaptel.c

Modified: branches/1.4/zaptel.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/zaptel.c?view=diff&rev=1606&r1=1605&r2=1606
==============================================================================
--- branches/1.4/zaptel.c (original)
+++ branches/1.4/zaptel.c Thu Nov 16 17:13:14 2006
@@ -2347,8 +2347,10 @@
 		else if ((chans[unit]->sig & __ZT_SIG_DACS) == __ZT_SIG_DACS)
 			res = -EBUSY;
 		else {
+			unsigned long flags;
 			/* Assume everything is going to be okay */
 			res = initialize_channel(chans[unit]);
+			spin_lock_irqsave(&chans[unit]->lock, flags);
 			if (chans[unit]->flags & ZT_FLAG_PSEUDO) 
 				chans[unit]->flags |= ZT_FLAG_AUDIO;
 			if (chans[unit]->span && chans[unit]->span->open)
@@ -2360,7 +2362,9 @@
 					MOD_INC_USE_COUNT;
 #endif					
 				chans[unit]->flags |= ZT_FLAG_OPEN;
+				spin_unlock_irqrestore(&chans[unit]->lock, flags);
 			} else {
+				spin_unlock_irqrestore(&chans[unit]->lock, flags);
 				close_channel(chans[unit]);
 			}
 		}
@@ -2373,7 +2377,10 @@
 {
 	int res=0;
 	if (chans[unit]) {
+		unsigned long flags;
+		spin_lock_irqsave(&chans[unit]->lock, flags);
 		chans[unit]->flags &= ~ZT_FLAG_OPEN;
+		spin_unlock_irqrestore(&chans[unit]->lock, flags);
 		chans[unit]->file = NULL;
 		close_channel(chans[unit]);
 		if (chans[unit]->span && chans[unit]->span->close)



More information about the zaptel-commits mailing list