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

Thanks for clearing that up. I worked with threading a lot in C# hence my misconception that it could be used for spinlocks in C/C++ too.


Yeah C#'s volatile has much larger semantics. IIRC on top of preventing the elision of loads and stores on the volatile, it prevents reordering of memory accesses across accesses to the volatile[0] and disables thread-unsafe optimisations (e.g. thread-local caching).




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

Search: