Mutex: Difference between revisions
Content added Content deleted
(This is not written as a task.) |
|||
Line 641: | Line 641: | ||
If the channel is empty, a task will wait until an object is available into the channel. |
If the channel is empty, a task will wait until an object is available into the channel. |
||
<lang Oforth> |
<lang Oforth>import: parallel |
||
{ |
|||
: job(mut) |
|||
mut receive drop |
mut receive drop |
||
"I get the mutex !" |
"I get the mutex !" . |
||
2000 sleep |
|||
"Now I release the mutex" println |
"Now I release the mutex" println |
||
mut send |
1 mut send drop ; |
||
} |
|||
⚫ | |||
⚫ | |||
{ |
|||
| mut | |
| mut | |
||
Channel new dup send(1) drop ->mut |
Channel new dup send(1) drop ->mut |
||
#[ #[ |
10 #[ #[ mut job ] & ] times ;</lang> |
||
}</lang> |
|||
=={{header|Oz}}== |
=={{header|Oz}}== |