illinois-cs241 / coursebook

Open Source Introductory Systems Programming Textbook for the University of Illinois
http://cs241.cs.illinois.edu/coursebook
666 stars 80 forks source link

Why setting cv->head to next of new node #186

Open WweiL opened 2 years ago

WweiL commented 2 years ago

https://github.com/illinois-cs241/coursebook/blob/1b53e6d38f4fff1f45fc25efd3a24111de35383e/appendix/appendix.tex#L846

I was wondering the purpose of this line here. It seems that it is setting the head again to itself so essentially this line doesn't do anything. Should it be setting head to my_node?

WweiL commented 2 years ago

Also I believe

https://github.com/illinois-cs241/coursebook/blob/1b53e6d38f4fff1f45fc25efd3a24111de35383e/appendix/appendix.tex#L850

should be

while(my_node.is_awoken == 0) {

WweiL commented 2 years ago

And probably the mutex dynamic inside

https://github.com/illinois-cs241/coursebook/blob/1b53e6d38f4fff1f45fc25efd3a24111de35383e/appendix/appendix.tex#L780-L784

should rather be defined inside

https://github.com/illinois-cs241/coursebook/blob/1b53e6d38f4fff1f45fc25efd3a24111de35383e/appendix/appendix.tex#L786-L788