Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errata for Page 180 #24

Closed
chihyang opened this issue Jun 27, 2019 · 1 comment
Closed

Errata for Page 180 #24

chihyang opened this issue Jun 27, 2019 · 1 comment

Comments

@chihyang
Copy link

chihyang commented Jun 27, 2019

The third line from the end of page 180 says:

So the first two items, 300 and 205, are printed by the main thread.

But according to the program on page 181:

let buffer = 0
       in let producer = proc (n)
              letrec
                wait4(k) = if zero?(k)
                           then set buffer = n
                           else begin
                                  print(-(k,-200));
                                  (wait4 -(k,1))
                                end
                in (wait4 5)
          in let consumer = proc (d)
                  letrec busywait(k) = if zero?(buffer)
                                       then begin
                                             print(-(k,-100));
                                             (busywait -(k,-1))
                                            end
                                       else buffer
                  in (busywait 0)
              in begin
                  spawn(proc (d) (producer 44));
                  print(300);
                  (consumer 86)
                 end

205 is printed by subthread. So the text on page 180 might be:

So the first two items, 300 and 205, are printed by the main thread and the subthread respectively.

@mwand
Copy link
Owner

mwand commented Apr 3, 2020

You are right, of course. I will make an entry in the errata. If you send me your name or email, I will credit you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants