[zaptel-commits] mattf: trunk r1607 - /trunk/zaptel.c
zaptel-commits at lists.digium.com
zaptel-commits at lists.digium.com
Thu Nov 16 17:51:11 MST 2006
Author: mattf
Date: Thu Nov 16 18:51:10 2006
New Revision: 1607
URL: http://svn.digium.com/view/zaptel?view=rev&rev=1607
Log:
Make the master span change more atomic, in face of not doing actual locking like we need to do.
Modified:
trunk/zaptel.c
Modified: trunk/zaptel.c
URL: http://svn.digium.com/view/zaptel/trunk/zaptel.c?view=diff&rev=1607&r1=1606&r2=1607
==============================================================================
--- trunk/zaptel.c (original)
+++ trunk/zaptel.c Thu Nov 16 18:51:10 2006
@@ -4731,16 +4731,23 @@
span->flags &= ~ZT_FLAG_REGISTERED;
for (x=0;x<span->channels;x++)
zt_chan_unreg(&span->chans[x]);
- maxspans = 0;
+ new_maxspans = 0;
+ new_master = master; /* FIXME: locking */
if (master == span)
- master = NULL;
+ new_master = NULL;
for (x=1;x<ZT_MAX_SPANS;x++) {
if (spans[x]) {
- maxspans = x+1;
- if (!master)
- master = spans[x];
- }
- }
+ new_maxspans = x+1;
+ if (!new_master)
+ new_master = spans[x];
+ }
+ }
+ maxspans = new_maxspans;
+ if (master != new_master)
+ if (debug)
+ printk("%s: Span ('%s') is new master\n", __FUNCTION__,
+ (new_master)? new_master->name: "no master");
+ master = new_master;
return 0;
}
More information about the zaptel-commits
mailing list