logoalt Hacker News

shawnztoday at 6:04 PM1 replyview on HN

Your entire codebase is already at risk of being blocked by a spinlock or CPU-intensive operation, so what's the difference?


Replies

dullcrisptoday at 6:17 PM

If you haven’t taken a lock, any other code can start executing at any time, so any invariant you might have established on one line may no longer be true on the next line.

If you don’t depend on anything mutable that anyone else can modify then this is mitigated, but that’s a very specific discipline you have to abide by.