<code>.unlock()</code> on a regular variable (like an array or scalar) will return an error.</p>
<p><strong>Canonical Example:</strong>
<div class="highlight"><pre><span></span><code>lock_obj = $thread();
lock_obj.lock();
// ... perform thread-safe operations on shared data ...
lock_obj.unlock();
</code></pre></div></p>
<p>See <a href="../sys/thread/">Threading and Locking</a> and <a href="../operators/function/">Function Operators: static and const</a> for details and best practices.</p>
<hr />
<h2 id="1-e