Mutex: Difference between revisions

Content deleted Content added
Sonia (talk | contribs)
→‎{{header|Go}}: added channel version
Sonia (talk | contribs)
m →‎sync.Mutex: shortened url
Line 298:
2
</pre>
Read-write mutex is provided by the <tt>sync.RWMutex</tt> type. For a code example using a RWMutex, see [http://rosettacode.org/wiki/Atomic_updates#RWMutex [Atomic updates#RWMutex]].
 
===Channels===
If a mutex is exactly what you need, sync.Mutex is there. As soon as things start getting complicated though, Go channels offer a much clearer alternative. As a gateway from mutexes to channels, here is the above program implemented with channels: