Skip to content

Commit e30daef

Browse files
committed
More blackboard fixes
1 parent b2a5f8c commit e30daef

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/bif_bboard.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,13 @@ static bool bif_bb_put_2(query *q)
126126
dup_cells(val, tmp, tmp->num_cells);
127127

128128
prolog_lock(q->pl);
129-
sl_del(q->pl->keyval, key1);
130-
sl_del(q->pl->keyval, key2);
129+
130+
while (sl_del(q->pl->keyval, key1))
131+
;
132+
133+
while (sl_del(q->pl->keyval, key2))
134+
;
135+
131136
sl_app(q->pl->keyval, key2, val);
132137
prolog_unlock(q->pl);
133138

@@ -270,6 +275,12 @@ static bool bif_bb_delete_2(query *q)
270275
}
271276

272277
bool ok = sl_del(q->pl->keyval, key);
278+
279+
if (ok) {
280+
while (sl_del(q->pl->keyval, key))
281+
;
282+
}
283+
273284
prolog_unlock(q->pl);
274285
return ok;
275286
}
@@ -335,7 +346,10 @@ static bool bif_bb_update_3(query *q)
335346
cell *value = malloc(sizeof(cell)*tmp->num_cells);
336347
checked(value);
337348
dup_cells(value, tmp, tmp->num_cells);
338-
sl_del(q->pl->keyval, key);
349+
350+
while (sl_del(q->pl->keyval, key))
351+
;
352+
339353
sl_app(q->pl->keyval, key, value);
340354

341355
prolog_unlock(q->pl);

0 commit comments

Comments
 (0)