Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This isn't correct, if it was this would be a much bigger issue. I'd be quite surprised if this affects any code in the wild.

This bug is related to the compiler deciding to optimize the loop. All modifications of variables in the loop are being batched till the loop exits, but it never exits therefore none of the modifications ever happen. In most cases this would be fine as the side-effects of modifying the variables in the loop wouldn't need to visible anywhere else until the loop exited.

If you remove the loop and just modify the atomic variable once, the modification is eventually happens and is seen by the second go routine.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: