vault backup: 2025-03-12 11:09:27
This commit is contained in:
parent
d80a37f73e
commit
6bd7ddb752
1 changed files with 13 additions and 2 deletions
|
@ -101,7 +101,7 @@ B.consume() :=
|
||||||
B.produce(v) :=
|
B.produce(v) :=
|
||||||
FREE.down()
|
FREE.down()
|
||||||
SP.down()
|
SP.down()
|
||||||
while not EMPTY[in] do
|
while not EMPTY[in] do # there is at least an EMPTY cell, otherwise it would have been blocked
|
||||||
IN <- (IN+1) mod k
|
IN <- (IN+1) mod k
|
||||||
i <- IN
|
i <- IN
|
||||||
EMPTY[IN] <- ff
|
EMPTY[IN] <- ff
|
||||||
|
@ -111,5 +111,16 @@ B.produce(v) :=
|
||||||
BUSY.up()
|
BUSY.up()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
B.consume() :=
|
||||||
|
BUSY.down()
|
||||||
|
SC.down()
|
||||||
|
while not FULL[OUT] do
|
||||||
|
OUT <- (OUT+1) mod k
|
||||||
|
o <- OUT
|
||||||
|
FULL[OUT] <- ff
|
||||||
|
SC.up()
|
||||||
|
tmp <- BUF[o]
|
||||||
|
EMPTY[o] <- tt
|
||||||
|
FREE.up()
|
||||||
|
return tmp
|
||||||
```
|
```
|
Loading…
Reference in a new issue