Anonymous user
Mutex: Difference between revisions
added Go
(Added PicoLisp) |
(added Go) |
||
Line 171:
<code>when</code> blocks and <code>Ref.whenResolved</code> return a ''promise'' for the result of the deferred action, so the mutex here waits for the gratuitously complicated increment to complete before becoming available for the next action.
=={{header|Go}}==
<lang go>import "sync"
func main() {
m := new(sync.Mutex)
m.Lock() // locks
m.Unlock() // unlocks
}</lang>
Read-write mutex is provided by the <tt>sync.RWMutex</tt> type.
=={{header|Java}}==
{{works with|Java|1.5+}}
|