Skip to content

Conversation

@nox213
Copy link
Contributor

@nox213 nox213 commented Nov 13, 2023

Hi, I'm reading your book these days (thanks for your interesting book) , and I ran into the error below while I was running LockFreePool example.
image

I think the reason is because the existing implementation incorrectly terminates the loop without checking the bucket at the starting index (start). So, I fixed it by modifying the loop to do-while from while and initializing i with start instead of (start + 1) % buckets.length. It will ensure that the bucket at the starting index is also considered during the scan.

@axel22
Copy link
Member

axel22 commented Nov 13, 2023

Yes, from looking at the code, that looks like a correct analysis and the right fix as far as I can see. Thank you for the patch!

@axel22 axel22 merged commit 95f2b12 into concurrent-programming-in-scala:master Nov 13, 2023
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

Successfully merging this pull request may close these issues.

2 participants