Mutex: Difference between revisions
m
→sync.Mutex: shortened url
(→{{header|Go}}: added channel version) |
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 [
===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:
|