|
|
|
|
|
by mrkeen
681 days ago
|
|
> Do traffic lights protect the flow of traffic, or do they protect people? It seems reductive to fixate on traffic lights stopping intersecting flows of traffic, when the intent is to ultimately protect people from slamming into (and thus injuring/killing) each other. Had the author of the article weighed in, then yes: They protect the flow of traffic, people, an int, pretty much anything! > Similarly, it seems odd to me to suggest that a mutex protects code -- what is it protecting that code from? It is protecting the code from simultaneous execution. The burden of protecting the data still falls on the programmer. Mutexes literally appear so in the code. They wrap sections of imperative statements, or methods. They don't wrap data, eg: Mutex<Int> myInt;
> Controlling something isn't the same as protecting that something. A traffic light controls trafficGreat example. Drivers die in intersections. The cause is driver inattention. The traffic lights don't lose their licence. I only asked it as a question because others could hypothetically point out that Go mutexes can protect data (and NOT via metaphor) - maybe I missed something! |
|