←back to thread

159 points mpweiher | 1 comments | | HN request time: 0.204s | source
Show context
t8sr ◴[] No.43671930[source]
When I did my 20% on Go at Google, about 10 years ago, we already had a semi-formal rule that channels must not appear in exported function signatures. It turns out that using CSP in any large, complex codebase is asking for trouble, and that this is true even about projects where members of the core Go team did the CSP.

If you take enough steps back and really think about it, the only synchronization primitive that exists is a futex (and maybe atomics). Everything else is an abstraction of some kind. If you're really determined, you can build anything out of anything. That doesn't mean it's always a good idea.

Looking back, I'd say channels are far superior to condition variables as a synchronized cross-thread communication mechanism - when I use them these days, it's mostly for that. Locks (mutexes) are really performant and easy to understand and generally better for mutual exclusion. (It's in the name!)

replies(5): >>43672034 #>>43672125 #>>43672192 #>>43672501 #>>43687905 #
throwaway150 ◴[] No.43672034[source]
What is "20% on Go"? What is it 20% of?
replies(3): >>43672063 #>>43672064 #>>43672071 #
1. NiloCK ◴[] No.43672063[source]
Google historically allowed employees to self-direct 20% of their working time (onto any google project I think).