logoalt Hacker News

menaerusyesterday at 7:25 PM1 replyview on HN

Ok, I see, thanks for the example. Is this technique used to avoid the potential runtime performance cost because one would otherwise need to keep that object elsewhere/heap and not on a stack? Or is the problem definition something else?


Replies

jcalvinowensyesterday at 7:38 PM

It's just mechanically simpler that way. If the wakee thread dynamically allocated the object, it would have to free it after being woken: may as well let the compiler do that automatically for us.