Mutex: Difference between revisions

10 bytes removed ,  7 years ago
m
(This is not written as a task.)
Line 641:
If the channel is empty, a task will wait until an object is available into the channel.
 
<lang Oforth>funcimport: job(mut)parallel
 
{
: job(mut)
mut receive drop
"I get the mutex !" println.
System2000 sleep(2000)
"Now I release the mutex" println
1 mut send(1) drop ;
}
func: mymutex
 
func: mymutex
{
| mut |
Channel new dup send(1) drop ->mut
10 #[ #[ job(mut) job ] & ] times(10) ;</lang>
}</lang>
 
=={{header|Oz}}==
1,015

edits