Mutex: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
m (→‎{{header|Raku}}: 'Perl 6' to 'Raku')
Line 1,232:
 
$lock.protect: { your-ad-here() }</syntaxhighlight>
Locks are reentrant. You may explicitly lock and unlock them, but the syntax above guarantees the lock will be unlocked on scope exit, even if by thrown exception or other exotic control flow. That being said, direct use of locks is discouraged in Perl 6Raku in favor of promises, channels, and supplies, which offer better composable semantics.
 
=={{header|Ruby}}==