fix(v4.0.0): wire review round 1 -- tests for the wake-up order and for waking only on enough room; no overflow moving a message; sleep for impossible room answers at once
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d5cd64605d
commit
83694b18be
+2
-2
@@ -370,8 +370,8 @@ static int operate(v4_fabric *f, unsigned id, v4_cell *how)
|
||||
break;
|
||||
case 9: /* sleep for room */
|
||||
if (!tx) { *how = V4_WIRE_NO_ONE; break; }
|
||||
if (a < 0) { *how = V4_WIRE_NOT_A_MESSAGE; break; }
|
||||
if (a <= (v4_cell)V4_WIRE_CELLS && v4_wire_room(tx, (unsigned)a) == V4_WIRE_DONE) { *how = V4_WIRE_DONE; break; }
|
||||
if (a < 0 || a > (v4_cell)V4_WIRE_CELLS) { *how = V4_WIRE_NO_ROOM; break; } /* no waiting can make that room */
|
||||
if (v4_wire_room(tx, (unsigned)a) == V4_WIRE_DONE) { *how = V4_WIRE_DONE; break; }
|
||||
if (!arrived(f, id)) return 0;
|
||||
*how = V4_WIRE_NO_ROOM;
|
||||
break;
|
||||
|
||||
+1
-1
@@ -118,7 +118,7 @@ int v4_wire_move(v4_wire_queue *from, v4_wire_queue *to)
|
||||
if (from == to || v4_wire_room(to, n) != V4_WIRE_DONE) return V4_WIRE_NO_ROOM;
|
||||
at = back(to, n);
|
||||
for (i = 0; i < n; i++) to->cell[slot(to, at + i)] = from->cell[slot(from, from->mark + i)];
|
||||
to->cell[slot(to, at + 3u)] = (v4_cell)(from->cell[slot(from, from->mark + 3u)] - 1);
|
||||
to->cell[slot(to, at + 3u)] = (v4_cell)((v4_ucell)from->cell[slot(from, from->mark + 3u)] - 1u); /* in the unsigned type: no overflow at the least cell */
|
||||
remove_marked(from);
|
||||
return V4_WIRE_DONE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user