[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Wed Apr 27 14:31:05 2005 -->
- <!--x-from-r13: syrgpu ng culqrnhk.bet (Tyrgpu) -->
- <!--x-message-id: [email protected] -->
- <!--x-reference: [email protected] -->
- <!--x-reference: [email protected] --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] Perl threads -->
- <li><em>date</em>: Wed Apr 27 14:31:05 2005</li>
- <li><em>from</em>: fletch at phydeaux.org (Fletch)</li>
- <li><em>in-reply-to</em>: <<a href="msg00701.html">[email protected]</a>> (Christopher Fowler's message of "Tue, 26 Apr 2005 19:00:57 -0400")</li>
- <li><em>references</em>: <<a href="msg00700.html">[email protected]</a>> <<a href="msg00701.html">[email protected]</a>></li>
- <li><em>subject</em>: [ale] Perl threads</li>
Christopher> I looked at perthrtut and there seems to be a lock()
Christopher> function but no unlock. I want to lock a variable in
Christopher> the main program as well as a thread.
If I remember correctly, locks are only active for the enclosing
lexical scope (similar to the lifetime of a lexical variable declared
with my). The way to lock a smaller chunk of code is to wrap it in
its own block with a lock($whoozits) at the top.
What you might want to do is use a higher level exclusion mechanism
like Thread::Semaphore instead of the low level lock().
Having said that, unless things have really changed conventional
wisdom has been "don't use threads in Perl". In general you'll be
better served by forking coprocesses, or using POE and letting it hide
the nastyness.
--
Fletch | "If you find my answers frightening, __`'/|
fletch at phydeaux.org| Vincent, you should cease askin' \ o.O'
| scary questions." -- Jules =(___)=
| U
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00736" href="msg00736.html">[ale] Perl threads</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00700" href="msg00700.html">[ale] Perl threads</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
<li><strong><a name="00701" href="msg00701.html">[ale] Perl threads</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00724.html">ping! Mike Trausch Re: [ale] superblock recovery?</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00726.html">[ale] Never mind. I got it. Thanks->Re: HOW2 cut&paste using xterm ?</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00701.html">[ale] Perl threads</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00736.html">[ale] Perl threads</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00725"><strong>Date</strong></a></li>
<li><a href="threads.html#00725"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>