Mutex: Difference between revisions
Content added Content deleted
(Added PicoLisp) |
(added Go) |
||
Line 171: | 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. |
<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}}== |
=={{header|Java}}== |
||
{{works with|Java|1.5+}} |
{{works with|Java|1.5+}} |