Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rochus-keller committed Jan 10, 2024
1 parent a494beb commit f7b532c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions _posts/2023-12-25-towards-concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,9 @@ module Eratosthenes
import Out, Buffers
const N = 1000; Terminate = -1
type Sieve = pointer to monitor buf: Buffers.Buffer
prime, n: integer; next: Sieve end
type Sieve = pointer to monitor
buf: Buffers.Buffer
prime, n: integer; next: Sieve end
procedure (this: Sieve) Init
begin
Expand All @@ -519,6 +520,7 @@ end Init
procedure (this: Sieve) Put(n: integer)
begin
await( ~buf.IsFull() )
this.buf.Put(n)
end Put
Expand All @@ -533,8 +535,7 @@ begin
Out.Int(n, 0); Out.String(" is prime");
Out.Ln;
prime := n;
new(next)
next.Init
new(next); next.Init
elsif (n mod prime) # 0 THEN
next.Put (n)
end
Expand All @@ -550,8 +551,7 @@ end Run
var s: Sieve; i: integer
begin
new(s)
s.Init
new(s); s.Init
for i := 2 to N-1 do s.Put(i) end
s.Put(Terminate)
end Eratosthenes
Expand Down

0 comments on commit f7b532c

Please sign in to comment.