Jump to content

Mutex: Difference between revisions

200 bytes added ,  14 years ago
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+}}
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.