Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
procedure main(A)
|
||||
fName := A[1]|"index.txt"
|
||||
p := thread produce(fName)
|
||||
c := thread consume(p)
|
||||
every wait(p | c)
|
||||
end
|
||||
|
||||
procedure produce(fName)
|
||||
every !open(fName)@>> # drop messages in p's outbox (blocking whenever box is full)
|
||||
@>> # Signal consumer that p is done
|
||||
write("count is ",<<@) # block until message in p's inbox
|
||||
end
|
||||
|
||||
procedure consume(p)
|
||||
i := 0
|
||||
while write(\<<@p) do (i+:=1) # loop until empty message in p's outbox
|
||||
# (blocking until each message arrives)
|
||||
i@>>p # put row count into p's inbox
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue