Jun 21, 2018

[Go] empty select

select{} // this block forever
i.e In CSP-speak, the empty select is like STOP, a process that never proceeds. This is akin to a self-deadlock and I imagine it doesn't get used all that often. However, the question proposed an interesting and genuine use-case for this pattern. An empty for{} loop is a self-livelock, different because it consumes cpu resources.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.