aboutsummaryrefslogtreecommitdiffstats
path: root/libibex/ibex_block.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-08-15 22:41:57 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-08-15 22:41:57 +0800
commit95cad50c053fda877e2a640d7301c31704b4c889 (patch)
treefdce28d788469b575a3398f091dcc1235fdd3911 /libibex/ibex_block.c
parent580a9b1815c0def8b58d2fc7b155cc4dfdb41c86 (diff)
downloadgsoc2013-evolution-95cad50c053fda877e2a640d7301c31704b4c889.tar.gz
gsoc2013-evolution-95cad50c053fda877e2a640d7301c31704b4c889.tar.zst
gsoc2013-evolution-95cad50c053fda877e2a640d7301c31704b4c889.zip
Use a next pointer so we keep the list intact as we scan it.
2001-08-16 Not Zed <NotZed@Ximian.com> * ibex_block.c (ibex_use): Use a next pointer so we keep the list intact as we scan it. svn path=/trunk/; revision=12049
Diffstat (limited to 'libibex/ibex_block.c')
-rw-r--r--libibex/ibex_block.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libibex/ibex_block.c b/libibex/ibex_block.c
index ea326949ae..23b225cbc6 100644
--- a/libibex/ibex_block.c
+++ b/libibex/ibex_block.c
@@ -33,7 +33,7 @@ int ibex_opened; /* count of actually opened ibexe's */
/* TODO: return errors? */
static void ibex_use(ibex *ib)
{
- ibex *wb;
+ ibex *wb, *wn;
/* always lock list then ibex */
IBEX_LIST_LOCK(ib);
@@ -66,8 +66,8 @@ static void ibex_use(ibex *ib)
we can't do this first for locking issues */
if (ibex_opened > IBEX_OPEN_THRESHOLD) {
wb = (ibex *)ibex_list.head;
- while (wb->next) {
- wb = wb->next;
+ wn = wb->next;
+ while (wn) {
IBEX_LOCK(wb);
if (wb->usecount == 0 && wb->blocks != NULL) {
o(printf("Forcing close of obex '%s', total = %d\n", wb->name, ibex_opened-1));
@@ -80,6 +80,8 @@ static void ibex_use(ibex *ib)
break;
}
IBEX_UNLOCK(wb);
+ wb = wn;
+ wn = wn->next;
}
}